Hi Tom,

really cool idea, but it does not work...

<select name="berufe" id="berufe" onchange="onSubmitFilterForm();">
                                <option value="0">-- Bitte Berufsgruppe wählen 
--</option>
                                {% for item in berufe %}
                                        <option value="{{item.id}}" {% ifequal 
berufe_id item.id|
stringformat:"s" %}selected{% endifequal %}>{{item.name}}</option>
                                {% endfor %}
                        </select>

does not select any option...

Any more hints?

On Mar 10, 5:13 pm, Tom Evans <tevans...@googlemail.com> wrote:
> On Wed, Mar 10, 2010 at 3:37 PM, Bill Freeman <ke1g...@gmail.com> wrote:
> > That would be my guess.  I presume that item.id is an int, so it's
> > likely that you're passing berufe_id as a string.  All the stuff that
> > comes from the GET or POST attributes or request, and any
> > arguments garnered by the url pattern are strings.  If you're not
> > converting it yourself, berufe_id will be a string, and:
>
> >  >>> 1 == '1'
> >  False
> >  >>>
>
> > Do you have a view function, or are you fitting this into a generic
> > view somehow?
>
> > Too bad that there doesn't seem to be a filter to invoke the int 
> > constructor,
> > or a string method that does it.  You could add a method to your model
> > that returns id as a string, then
>
> >   ...{% ifequal item.id_as_string berufe_id %}...
>
> {% ifequal item.id|stringformat:"s" berufe_id %}
>
> Cheers
>
> Tom

-- 
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