When trying to implement a custom get_success_url
method in python, Django throws a TypeError: quote_from_bytes()
error. For example:
class SomeView(generic.CreateView):
#...
def get_success_url(self):
return HttpResponseRedirect(reverse('index'))
get_success_url
doesn't return an HttpResponseRedirect instead it should return the url you want to redirect to. So you can just return reverse('index')
:
def get_success_url(self):
return reverse('index')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With