diff --git a/contacts/forms.py b/contacts/forms.py index 78d33eb..bad8c1b 100644 --- a/contacts/forms.py +++ b/contacts/forms.py @@ -1,7 +1,7 @@ from django import forms from .models import Contact -class ContactForm(forms.modelForm): +class ContactForm(forms.ModelForm): class Meta: model = Contact fields = ('name', 'age',) \ No newline at end of file diff --git a/contacts/templates/contacts/contact_detail.html b/contacts/templates/contacts/contact_detail.html index 535d108..68a1ea3 100644 --- a/contacts/templates/contacts/contact_detail.html +++ b/contacts/templates/contacts/contact_detail.html @@ -1,6 +1,7 @@ {% extends 'contacts/base.html' %} {% block content %} -

{{ contact.name }} (edit)

+

{{ contact.name }} (edit)

Age: {{ contact.age }}

+Delete contact {% endblock %} \ No newline at end of file diff --git a/contacts/templates/contacts/contact_form.html b/contacts/templates/contacts/contact_form.html new file mode 100644 index 0000000..01c37c6 --- /dev/null +++ b/contacts/templates/contacts/contact_form.html @@ -0,0 +1,8 @@ + +{% extends 'contacts/base.html' %} {% block content %} +

New Contact

+
+ {% csrf_token %} {{ form.as_p }} + +
+{% endblock %} \ No newline at end of file diff --git a/contacts/templates/contacts/contact_list.html b/contacts/templates/contacts/contact_list.html index dec0996..8e14958 100644 --- a/contacts/templates/contacts/contact_list.html +++ b/contacts/templates/contacts/contact_list.html @@ -1,7 +1,7 @@ {% extends 'contacts/base.html' %} {% block content %} -

Contacts (+)

+

Contacts (+)