From d812e14d8678dad36c090b36280dccd22d5aeb67 Mon Sep 17 00:00:00 2001 From: David Stanek Date: Sun, 4 Nov 2012 07:35:42 -0500 Subject: hello world with inheritance --- README.md | 8 ++++++++ codemash/templates/base.html | 11 +++++++++++ codemash/templates/index.html | 18 ++++++++---------- 3 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 codemash/templates/base.html diff --git a/README.md b/README.md index 1899655..8e57b27 100644 --- a/README.md +++ b/README.md @@ -46,3 +46,11 @@ edit codemash/urls.py yay, Hello Codemash! ## tag: 1.hello + + +Step 3: Getting ready for a bigger project +========================================== + +Student create a base.html + +Student modifies index.html to inherit from base.html diff --git a/codemash/templates/base.html b/codemash/templates/base.html new file mode 100644 index 0000000..bb85256 --- /dev/null +++ b/codemash/templates/base.html @@ -0,0 +1,11 @@ + + + + Hello Codemash: {% block title %}TODO: add custom content using child templates{% endblock %} + + + + {% block main %}TODO: add custom content using child templates{% endblock %} + + + diff --git a/codemash/templates/index.html b/codemash/templates/index.html index ba0a13a..29c949d 100644 --- a/codemash/templates/index.html +++ b/codemash/templates/index.html @@ -1,10 +1,8 @@ - - - - Hello Codemash! - - -

It worked!

-

Congratulations on your second Django-powered page.

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

It worked!

+

Congratulations on your second Django-powered page.

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