You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
I am struggling to understand block tags. I have two block tags in my HTML template as follows:
<h2>
{% block side_hdr %}{% endblock%}
</h2>
{% block content %}{% endblock %}
How (if possible) do I set these tags in my class based view?
class TestView(TemplateView):
template_name = "base.html"
Thanks.
Lachlan Musicman
unread,
Aug 18, 2014, 7:07:34 AM8/18/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
You don't set the block tags in the view. You set the variables in the
view - in this example you set var_1_from_view (a single object) and
var_2_from_view (a collection/list of sorts)
<h2>
{% block side_hdr %}{% endblock%}
</h2>
{% block content %}
{{ var_1_from_view }}
{% for item in var_2_from_view %}
{{ item }}
{% endfor %}
{% endblock %}
When using GenericViews (like TemplateView) there is usually already a
named variable to be sent to the template, like
{{ object }}
{{ object.name }}
{% if object.colour is green %}
{{ object.date_made }}
{% endif %}
This is probably the better example than TemplateViews
--
You have to be really clever to come up with a genuinely dangerous
thought. I am disheartened that people can be clever enough to do that
and not clever enough to do the obvious thing and KEEP THEIR IDIOT
MOUTHS SHUT about it, because it is much more important to sound
intelligent when talking to your friends.
This post was STUPID.
-----------------------------------------------------------------------------------------------------------
The Most Terrifying Thought Experiment of All Time
http://www.slate.com/articles/technology/bitwise/2014/07/roko_s_basilisk_the_most_terrifying_thought_experiment_of_all_time.html