19👍
✅
You have to define get_absolute_url for the model:
from django.core.urlresolvers import reverse
class Car(models.Model):
name = models.CharField('Name', max_length=10)
active = models.BooleanField()
def __unicode__(self):
return self.name
def get_absolute_url(self):
return reverse('car_details', kwargs={'name':self.name})
Please update the URL reverse method according to the URL you have defined.
Source:stackexchange.com