Skip to content

Commit

Permalink
20 - Template Tags and Filters
Browse files Browse the repository at this point in the history
  • Loading branch information
codingforentrepreneurs committed Jul 5, 2018
1 parent 0b11a44 commit d2a9d77
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/pages/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ def contact_view(request, *args, **kwargs):

def about_view(request, *args, **kwargs):
my_context = {
"my_text": "This is about us",
"title": "abc this is about us",
"this_is_true": True,
"my_number": 123,
"my_list": [1313, 4231, 312, "Abc"]
"my_list": [1313, 4231, 312, "Abc"],
"my_html": "<h1>Hello World</h1>"

}
return render(request, "about.html", my_context)
Expand Down
5 changes: 4 additions & 1 deletion src/templates/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

{% block content %}
<h1>About</h1>

<h3>{{ title }}</h3>
<p>This is a template</p>

{{ my_html|safe }}

<p>
{{ my_text }}, {{ my_number }}
, {{ my_number }}
{{ my_list }}
</p>

Expand Down

0 comments on commit d2a9d77

Please sign in to comment.