I have view that returns a whole bunch of different variables and
boolean flags. The state of these flags determine what the user
actually sees on their screen.
From a design perspective I seem to have two options:-
1. Design a template with lots of {% if %} conditional statements to
check the status of various flags, in order to display the appropriate
information to the user.
OR
2. Do the bulk of the work in the view, by doing something like:-
if conditions A:
template = "template_a.html"
elif conditions B:
template = "template_b.html"
else conditions C:
template = "template_c.html"
return render to response(template name,{dictionary_of_variables},)
3. Do a combination of the two above
Option number 2 lacks the flexibility of doing stuff in the template,
but would it make a big difference in speed? I am concerned that having
a lot of conditional statements in the template might be slower than
doing the work in the view.
Can anybody shed some light on this and the trade off (if any) of speed
versus flexibility.
MerMer
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---