You need to use the backlink to create the url to redirect to:
from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect def affiche(request): form = AfficheForm(request.POST or None) if request.method == 'POST': if form.is_valid(): Select = form.cleaned_data['Select'] if Select == '1': url = reverse('affiche_all', args=(), kwargs={'devise': 'EURO'}) return HttpResponseRedirect(url)
It is assumed that you have a named url pattern that accepts the argument of the 'devise' keyword, as such:
from django.conf.urls import url, patterns urlpatterns = patterns('your_app.views', url(r'^some-path/(?P<devise>[-\w]+)/$', 'affiche_all', name='affiche_all'), )
This named parameter will look for one or more words and hypens, like slug. You might want to change this to suit your needs.
source share