Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Form is rendered in Request Vars panel #367

Closed
sneawo opened this Issue · 6 comments

3 participants

Andrey Zhukov Lucas Inojosa Aymeric Augustin
Andrey Zhukov

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

    url(r"^invite/$",
        "friends_app.views.invite",
        kwargs={"template_name": "friends_app/invite_postcard.html", 
                             "form_class": InviteForm},
        name="invite"),

Screen Shot 2013-04-02 at 10 57 47

Lucas Inojosa

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

Lucas Inojosa

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.

Lucas Inojosa

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

Lucas Inojosa

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.

Aymeric Augustin
Owner

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

Aymeric Augustin
Owner

This was fixed in 982f341.

Aymeric Augustin aaugustin closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.