1👍
the signature of redirect
is different from reverse
, as you can see from the error, which shows it is using *args, **kwargs
rather than taking keyword arguments called args
and kwargs
(see also the docs: https://docs.djangoproject.com/en/1.8/topics/http/shortcuts/#redirect)
so you want:
return redirect('post-detail', self.kwargs['pk'])
or
return redirect('post-detail', pk=self.kwargs['pk'])
Source:stackexchange.com