19๐
โ
I try to answer, since I had the same problem but didnโt find an answer online.
I think the origin of this problem is a wrong get_absolute_url(...)
method. For example, if you write it like this:
@models.permalink
def get_absolute_url(self):
return reverse('my_named_url', kwargs={ "pk": self.pk })
Then it raises the exception reverse() argument after ** must be a mapping, not str
. Fix it removing the @models.permalink
decorator, as follows:
def get_absolute_url(self):
return reverse('my_named_url', kwargs={ "pk": self.pk })
or alternatively keep the decorator and modify the body, as follows:
@models.permalink
def get_absolute_url(self):
return ('my_named_url', (), { "pk": self.pk })
I think that the latter is deprecated, though.
๐คFSp
2๐
Naughty comma
return redirect(reverse_lazy('team-detail', kwargs={'pk', team.pk}))
it should be
return redirect(reverse_lazy('team-detail', kwargs={'pk': team.pk}))
๐คWeilory
Source:stackexchange.com