1👍
To redirect to another page in Django with parameters use this
return HttpResponseRedirect(reverse(viewname='the view to which it should redirect', args=(parameters to be passed)))
0👍
Use redirect
, it’s easier than invoking reverse
and HttpResponseRedirect
directly. (Doc)
from django.shortcuts import redirect
...
return redirect( 'myapp:url_name', urlparam=value, ...)
which is the same as
return HttpResponseRedirect(
reverse( 'myapp:url_name',
kwargs={ 'urlparam': value, ... }
)
- [Answered ]-Group by with related_name relation using Prefetch
- [Answered ]-Django or asp.net for business app
- [Answered ]-How to retain an added column in django queryset during serialization?
- [Answered ]-In Django how do I get code to run after an object is saved and after its many to many relationships are made?
- [Answered ]-Django Rest Framework: TypeError: Object of type Facility is not JSON serializable
Source:stackexchange.com