On Wednesday 09 Sep 2009 9:56:24 am putih wrote:
> then how to define the variables..??
here is a simple view which defines and passes some variables to the template:
def downall(request):
""" view for display of downloads
"""
lst = Downloadtype.objects.all()
return render_to_response('web/downall.html',
{'lst':lst,
'mn':makemenu('Downloads'),
'rbox':rightbox(),'request':request,
})
you will notice a dictionary of variables that can be used by the template.
Here is the template:
{% extends "basefull.html" %}
{% block centercontent %}
<h1>Choose download category</h1>
{% if lst %}
<ul>
{% for p in lst %}
<li>
<a href="/down/{{ p.id }}/">
{{ p.name }}
</a>
</li>
{% endfor %}
</ul>
{% else %}
<p>No download categories posted</p>
{% endif %}
{% endblock %}
I would suggest you learn some python before going further.
--
regards
kg
http://lawgon.livejournal.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---