Re: Changing template variables

2010-03-05 Thread Kevin Renskers
For those interested: In my base template I've added this: {% load custom_tags %} {% if form %} {% formerrors request form %} {% endif %} In my custom_tags template tags library: @register.simple_tag def formerrors(request, form): for field, errors in form.errors.items(): for

Re: Changing template variables

2010-03-04 Thread Kevin Renskers
I'll explain a bit more what precisely it is what I want to do: Django 1.2 comes with a new messages framework that allows for each message to have a different "level" (succes, error, warning, etc). I want to see if a form has errors, and if so, make a message for each error so all my notices and

Re: Changing template variables

2010-03-04 Thread Bill Freeman
Write your new view so that it can be used generically. On Thu, Mar 4, 2010 at 10:22 AM, Kevin Renskers 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,

Re: Changing template variables

2010-03-04 Thread Kevin Renskers
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 wrote: > Write your own view instead of using direct_to_template. > > > > On Thu, Mar 4, 2010 at 10:06 AM,

Re: Changing template variables

2010-03-04 Thread Bill Freeman
Write your own view instead of using direct_to_template. On Thu, Mar 4, 2010 at 10:06 AM, Kevin Renskers 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

Changing template variables

2010-03-04 Thread Kevin Renskers
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