Hello, I have a situation in my project where i need to make a redirection of the user to an url containing a parameter, (it is declared in the urls.py like:
url(r'^notamember/(?P<classname>\w+)/$',
notamember,
name='notamember'),)
How can i put that parameter in the return HttpResponseRedirect? I tried like: return HttpResponseRedirect('/classroom/notamember/classname'),anyway, this is foolish, i know, i cannot consider the 'classmane' as a parameter. For clarity, my view is:
def leave_classroom(request,classname):
theclass = Classroom.objects.get(classname = classname)
u = Membership.objects.filter(classroom=theclass).get(member = request.user).delete()
return HttpResponseRedirect('/classroom/notamember/theclass/')
how can i include the variable 'theclass' in that url? Thanks a lot!