Re: template ifequal substitution of value

2009-02-26 Thread Jesse
I figured out what to do. I created a new instance in the view.py: def search(request): newdate='1999' In the template I used the "Y" for both instances and was able to get the comparison to work: {% ifequal items.startdt|date:"Y" newdate|date:"Y" %} this does the correct compariso

template ifequal substitution of value

2009-02-25 Thread Jesse
I have two date fields: startdt and enddt. The template code that works is: {% ifequal items.startdt items.enddt %} this says startdt and enddt are the same (as seen in the template) {% endifequal %} In postgres I have a date value in the startdt and enddt fields stored like this:

Re: template ifequal

2006-02-02 Thread Luke Plant
On Thursday 02 February 2006 09:53, oggie rob wrote: > I don't think this is inconsistent. You normally put filters within > variables. I don't think you can put it within tags: Yes you can: >>> import django.template >>> django.template.Template('{% if var1|length_is:"0" %}You can use \ ... fi

Re: template ifequal

2006-02-02 Thread scum
You have a good point about the consistancy. The `ifequal` should mimic the `if` as much as possible. I think a bug report may be called for in this case.

Re: template ifequal

2006-02-02 Thread oggie rob
> This seems like a bug to me - certainly it is inconsistent behaviour between > {% if %} (where you can do 'var1|lower' etc) and {% ifeqaul %}. I would file > a bug report. I don't think this is inconsistent. You normally put filters within variables. I don't think you can put it within tags:

Re: template ifequal

2006-02-01 Thread Luke Plant
On Wednesday 01 February 2006 11:32, Karsu wrote: > I have 2 variables var1 and var2. Variables contains strings like > "testi", "Test" "TEsT". > > I need templates like this, but django throwed error.. > > {% ifequal var1|lower var2|lower %} > ---something--- > {% endifequall %} > > Is there any

Re: template ifequal

2006-02-01 Thread scum
To clarify some things in the last post: When I said, "the view should be handling all variable assignments if possible". I meant to say the controller should be handling all varialbe assignments. It's confusing because django calls controllers "views", and views "templates". They have a reason

Re: template ifequal

2006-02-01 Thread scum
Modifying template variables in the template throws out the model-view-controller way of doing things. In theory, the view should be handling all variable assignments if possible. Now, for your specific example, it seems it would be a pain to pass both a capitalized and a lowercased version of t

template ifequal

2006-02-01 Thread Karsu
I have 2 variables var1 and var2. Variables contains strings like "testi", "Test" "TEsT". I need templates like this, but django throwed error.. {% ifequal var1|lower var2|lower %} ---something--- {% endifequall %} Is there any good way to do this? Can i modify some template variables and then