parent
b8c6793d19
commit
be05b7fb81
@ -1,7 +1,7 @@
|
|||||||
from django import forms
|
from django import forms
|
||||||
from .models import Contact
|
from .models import Contact
|
||||||
|
|
||||||
class ContactForm(forms.modelForm):
|
class ContactForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Contact
|
model = Contact
|
||||||
fields = ('name', 'age',)
|
fields = ('name', 'age',)
|
||||||
@ -1,6 +1,7 @@
|
|||||||
<!-- including the base.html as a boilerplate -->
|
<!-- including the base.html as a boilerplate -->
|
||||||
{% extends 'contacts/base.html' %} {% block content %}
|
{% extends 'contacts/base.html' %} {% block content %}
|
||||||
<!-- contact detail content -->
|
<!-- contact detail content -->
|
||||||
<h2>{{ contact.name }} <a href="">(edit)</a></h2>
|
<h2>{{ contact.name }} <a href="{% url 'contact_edit' pk=contact.pk %}"}>(edit)</a></h2>
|
||||||
<h4>Age: {{ contact.age }}</h4>
|
<h4>Age: {{ contact.age }}</h4>
|
||||||
|
<a href="{% url 'contact_delete' pk=contact.pk %}">Delete contact</a>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<!-- tunr/templates/tunr/artist_form.html -->
|
||||||
|
{% extends 'contacts/base.html' %} {% block content %}
|
||||||
|
<h2>New Contact</h2>
|
||||||
|
<form method="POST">
|
||||||
|
{% csrf_token %} {{ form.as_p }}
|
||||||
|
<button type="submit">Save</button>
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
||||||
Loading…
Reference in new issue