[Fixed]-Django parameter gets none even on redirect with parameter

1πŸ‘

βœ…

in django urls list is parsed from 0th position, so in your urls,

url(r'^surveys', views.surveys_view, name='surveys')

has first priority, since the regular expression matches like any uri starting with surveys<whatever>, so either change the url settings to,

url(r'^surveys/$', views.surveys_view, name='survey-list'),
url(r'^surveys/(?P<survey>survey1|survey2)', views.surveys_view, name='survey-details'),

or change the order

url(r'^surveys/(?P<survey>survey1|survey2)', views.surveys_view, name='survey-detail'),
url(r'^surveys', views.surveys_view, name='survey-list'),

NOTE: notice there is also change in name parameter, since it is better to be set as a unique value

Leave a comment