You could modify your view function (typed off the top of my head, so
the details may be wrong):
# ...blah blah build your context...
for name, value in context.items():
context[name] = special_function(value)
return render_to_response('template.html', context)
If you have a number of views, then a helper function:
def render_special(context):
for name, value in context.items():
context[name] = special_function(value)
return render_to_response('template.html', context)
# then in your view:
# ..blah blah build your context...
return render_special(context)
--Ned.
http://nedbatchelder.com
Dennis Schmidt wrote:
> Hi there,
>
> I need to get every variable that will be printed out in my templates
> to be passed through a special function.
> Since I need this function globally and my variables are coming from
> various places I thought the best way to do this would be right before
> actually printing them to the template. Therefore I would create a
> custom filter. But then the 'problem' is that I would need to apply
> this filter manually {{ myVariable|myCustomFilter }} everytime which
> is kind of ugly.
>
> So I'm wondering if there is some way to tell django to use my filter
> for every output it makes for a specific template. Or maybe there is
> yet another good solution for this?
>
> I hope you can help me, thanks in advance,
>
> Dennis
> >
>
>
--
Ned Batchelder, http://nedbatchelder.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
-~----------~----~----~----~------~----~------~--~---