Code

Opened 4 years ago

Closed 4 years ago

#13775 closed (wontfix)

Clarify in docs that filters don't work in ifequal

Reported by: jogwen Owned by: nobody
Component: Documentation Version: 1.0
Severity: Keywords: ifequal filter
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Can you please make it a bit more explicit in http://docs.djangoproject.com/en/1.0/ref/templates/builtins/#ifequal that ifequal cannot evaluate its arguments - I just wasted several hours (and created several custom filters) trying to work out why

ifequal request.GET.ds_doc_type type.id|toUnicode

always evaluates to False when

{{request.GET.ds_doc_type}}({{request.GET.ds_doc_type|getType}})
and
{{type.id|toUnicode}}({{type.id|toUnicode|getType}})

looked identical when rendered to the screen.

I've now written a custom filter to do the equality check and am using it in an 'if' which seems to work ok.

Many Thanks,

Jo

Attachments (0)

Change History (1)

comment:1 Changed 4 years ago by lukeplant

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

The 1.0 branch is no longer receiving bugfixes (and that includes documentation). Why not use Django 1.2? Then you can do:

{% if request.GET.ds_doc_type == type.id|toUnicode %}

which will do what you want.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.