diff options
-rw-r--r-- | README.md | 8 | ||||
-rw-r--r-- | codemash/templates/base.html | 11 | ||||
-rw-r--r-- | codemash/templates/index.html | 18 |
3 files changed, 27 insertions, 10 deletions
@@ -46,3 +46,11 @@ edit codemash/urls.py | |||
46 | yay, Hello Codemash! | 46 | yay, Hello Codemash! |
47 | 47 | ||
48 | ## tag: 1.hello | 48 | ## tag: 1.hello |
49 | |||
50 | |||
51 | Step 3: Getting ready for a bigger project | ||
52 | ========================================== | ||
53 | |||
54 | Student create a base.html | ||
55 | |||
56 | 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 @@ | |||
1 | <!DOCTYPE html> | ||
2 | <html> | ||
3 | <head> | ||
4 | <title>Hello Codemash: {% block title %}TODO: add custom content using child templates{% endblock %}</title> | ||
5 | </head> | ||
6 | <body> | ||
7 | <div id="header">...header...</div> | ||
8 | {% block main %}TODO: add custom content using child templates{% endblock %} | ||
9 | <div id="footer">...footer...</div> | ||
10 | </body> | ||
11 | </html> | ||
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 @@ | |||
1 | <!DOCTYPE html> | 1 | {% extends "base.html" %} |
2 | <html> | 2 | |
3 | <head> | 3 | {% block title %}Hello{% endblock %} |
4 | <title>Hello Codemash!</title> | 4 | |
5 | </head> | 5 | {% block main %} |
6 | <body> | 6 | <h1>It worked!</h1> |
7 | <h1>It worked!</h1> | 7 | <h2>Congratulations on your second Django-powered page.</h2> |
8 | <h2>Congratulations on your second Django-powered page.</h2> | 8 | {% endblock %} |
9 | </body> | ||
10 | </html> | ||