How do I pass a function to a template in the extra_context. Thanks.
Update:
The idea is that in the template I could turn around and pass that function as a parameter to a filter.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Any reason you can’t just pass in the function reference?
Edit: Rats, that won’t work with generic views:
You could probably get around this by sticking your function in a dictionary, though it’s not very pretty:
I have to say that almost every time I start trying to make generic views do anything slightly out of the ordinary, I tend to waste a fair amount of time before just writing a four-line custom view that does what I need.