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
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:
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
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.
> 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:
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
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
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
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
9 matches
Mail list logo