Write your new view so that it can be used generically.

On Thu, Mar 4, 2010 at 10:22 AM, Kevin Renskers <i...@bolhoed.net> wrote:
> Well yes, but I do not want to change all of my views. I want a
> generic solution to change template variables before they get
> rendered.
>
>
> On Mar 4, 4:14 pm, Bill Freeman <ke1g...@gmail.com> wrote:
>> Write your own view instead of using direct_to_template.
>>
>>
>>
>> On Thu, Mar 4, 2010 at 10:06 AM, Kevin Renskers <i...@bolhoed.net> wrote:
>> > Hi,
>>
>> > I am wondering if it is possible to change template variables before
>> > they get rendered in a template.
>>
>> > For example, I use something like this in my template:
>> > return direct_to_template(request, template='index.html',
>> > extra_context={'form':form})
>>
>> > I would like to extend this form variable before the index.html
>> > template gets rendered.
>>
>> > My first though was making a template context processor, but I can't
>> > seem to be able to access template variables from it. My next thought
>> > was creating a piece of middleware with a process_response function,
>> > but also from this function it seems impossible to access the template
>> > variables.
>>
>> > Anyone got an idea on how to do this?
>>
>> > Thanks in advance,
>> > Kevin
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "Django users" group.
>> > To post to this group, send email to django-us...@googlegroups.com.
>> > To unsubscribe from this group, send email to 
>> > django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group 
>> > athttp://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to