Skip to content
Snippets Groups Projects
Commit c24928c4 authored by Morris, Sophie E (UG - Comp Sci & Elec Eng)'s avatar Morris, Sophie E (UG - Comp Sci & Elec Eng)
Browse files

Merge branch 'Sophie' into 'test3'

Update 1519 files

See merge request sm02810/com3014-team3!14
parents e55179b3 bf21e325
Branches test3
No related tags found
No related merge requests found
Showing
with 77 additions and 0 deletions
File added
File added
File added
File added
File added
File added
File added
from django.contrib import admin
from .models import Contact
admin.site.register(Contact)
from django.apps import AppConfig
class ContactsectionConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'contactsection'
from django import forms
from .models import Contact
class ContactForm(forms.ModelForm):
class Meta:
model = Contact
fields = ['name', 'email', 'subject', 'message']
\ No newline at end of file
# Generated by Django 4.1.7 on 2024-03-04 18:52
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Contact',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=128)),
('email', models.EmailField(max_length=254)),
('subject', models.CharField(max_length=256)),
('message', models.TextField()),
('sent_at', models.DateTimeField(auto_now=True)),
],
),
]
File added
File added
from django.db import models
class Contact(models.Model):
name = models.CharField(max_length = 128)
email = models.EmailField()
subject = models.CharField(max_length = 256)
message = models.TextField()
sent_at = models.DateTimeField(auto_now = True)
def __str__(self):
return f"{self.subject}"
\ No newline at end of file
<html>
<body>
<p>Welcome to the contact page. Fill out the form displayed below to get in touch with us</p>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Send</button>
</form>
</body>
</html>
\ No newline at end of file
<html>
<body>
<p>Thank you for contacting us, we will get back to you with a response as soon as we can.</p>
</body>
</html>
\ No newline at end of file
from django.test import TestCase
# Create your tests here.
from django.urls import include, path
from . import views
urlpatterns = [
path('', views.contact, name='contact'),
path('contact', views.contact, name='contact'),
path('success', views.success, name='success'),
]
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment