On Sun, 2009-01-18 at 03:26 -0800, phoebebright wrote:
> What is best practise if you want to use a variable defined in
> settings.py in a template?
> Pass it in via the view or call it directly in the template?
Since you can't access it directly in a template, that leaves only the
former option ("best practice" is not to attempt the impossible). Pass
it in. If you find yourself needing a particular setting regularly, you
could set up a context processor to populate context with the value(s)
you require, just like the media context processor does
(http://docs.djangoproject.com/en/dev/ref/templates/api/#django-core-context-processors-media
)
Regards,
Malcolm
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---