Form is rendered in Request Vars panel #367

sneawo opened this Issue Apr 2, 2013 · 6 comments


None yet

3 participants

sneawo commented Apr 2, 2013

If form is passed through urls kwargs, it's rendered.

        kwargs={"template_name": "friends_app/invite_postcard.html", 
                             "form_class": InviteForm},

Screen Shot 2013-04-02 at 10 57 47

lucasicf commented Apr 5, 2013

Could reproduce the bug. I'll try to fix it.

lucasicf commented Apr 5, 2013

Here lies the problem:

{% for k, v in view_kwargs.items %}
    {{ k }}={{ v }}{% if not forloop.last %}, {% endif %}
{% endfor %}

It shows the kwargs in the format "key=value". However, in the class_form attribute, the {{ v }} is the form, thus it renders it normally.

lucasicf commented Apr 5, 2013

What do you guys think about this solution I've written?
I'm converting all the args to its string representation before passing to the view for them to be safe when displaying.

lucasicf commented May 1, 2013

Bringing here the discussion from my commit.

@sneawo commented on b3df0e4 (23 days ago)
Looks good for me. Why not use str(arg)?

@lucasicf commented on b3df0e4 (5 minutes ago)
To avoid possible problems with unicode strings, but I tested some code and saw that it does not make difference.

'%s'%object calls __str__ and u'%s'%object calls __unicode__. There's no risk of getting an unicode string and trying to convert it to 8-bit strings.

I'll change it and send a pull request.


#418 describes a more holistic fix for this category of issues.


This was fixed in 982f341.

@aaugustin aaugustin closed this Oct 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment