From ab626f31a0645d87560d242a20dd60e01b3d3b46 Mon Sep 17 00:00:00 2001 From: Mike Crute Date: Tue, 4 Dec 2012 16:06:00 -0500 Subject: Brief diversion into template inheritance --- templates/base.html | 13 +++++++++++++ templates/contact/form.html | 29 ++++++++++++----------------- templates/contact/thanks.html | 23 +++++++++-------------- templates/index.html | 27 +++++++++++---------------- 4 files changed, 45 insertions(+), 47 deletions(-) create mode 100644 templates/base.html diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..136c66d --- /dev/null +++ b/templates/base.html @@ -0,0 +1,13 @@ + + + + + + {% block title %}CodeMash{% endblock %} + + + + {% block content %} + {% endblock %} + + diff --git a/templates/contact/form.html b/templates/contact/form.html index 7ada5e0..27b68f0 100644 --- a/templates/contact/form.html +++ b/templates/contact/form.html @@ -1,17 +1,12 @@ - - - - - - Contact Us - - - -

Contact Us

-
- {% csrf_token %} - {{ form.as_p }} - -
- - +{% extends "base.html" %} + +{% block title %}Contact Us{% endblock %} + +{% block content %} +

Contact Us

+
+ {% csrf_token %} + {{ form.as_p }} + +
+{% endblock %} diff --git a/templates/contact/thanks.html b/templates/contact/thanks.html index 67e8336..8e131f0 100644 --- a/templates/contact/thanks.html +++ b/templates/contact/thanks.html @@ -1,14 +1,9 @@ - - - - - - Thank You - - - -

Thanks for contacting us

-

We have sent the following message to the organizers. Thanks.

-

{{ form.message.value }}

- - +{% extends "base.html" %} + +{% block title %}Thank You{% endblock %} + +{% block content %} +

Thanks for contacting us

+

We have sent the following message to the organizers. Thanks.

+

{{ form.message.value }}

+{% endblock %} diff --git a/templates/index.html b/templates/index.html index 0ea840f..ff76c3e 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,16 +1,11 @@ - - - - - - Hello Codemash - - - -

Hello Codemash

- -

You've just created your first Django page. Pretty cool, eh?

- - +{% extends "base.html" %} + +{% block title %}Hello Codemash{% endblock %} + +{% block content %} +

Hello Codemash

+ +

You've just created your first Django page. Pretty cool, eh?

+{% endblock %} -- cgit v1.2.3