1👍
✅
It should be:
def get_absolute_url(self):
return "/prod/%s/car/%s" % (self.prod.id, self.id)
Also looking into your code there can be done two more improvements:
- Model class method should come after the fields
- You should use reverse-resolution-of-urls instead of hard coding the url
/prod/%s/car/%s
which is a bad way to do.
Source:stackexchange.com