Alexey Kostopravkin
Alexey Kostopravkin

Reputation: 29

Django menu with reverse and args

Helo I got a menu with item

Menu.add_item("main", MenuItem(u"add",
                               reverse("app.applicant_views.questionary",args={'exte':'app/layout.html'}),
                               weight=40))

url for questionary

url(r'^questionary/(?P<exte>[a-zA-Z]+)/$', 'app.applicant_views.questionary', name='questionary'),

and erorr

TemplateSyntaxError at /questionary/exte/
Invalid template name in 'extends' tag: ''. Got this from the 'exte' variable.

It looks like it send an empty str instead of 'app/layout.html'. Any Idea?

Upvotes: 0

Views: 53

Answers (1)

Ali
Ali

Reputation: 3666

You need to use kwargs, reverse("app.applicant_views.questionary", kwargs ={'exte':'app/layout.html'}). Docs

Upvotes: 1

Related Questions