django save value for each instance code example
Example 1: str django
def __str__(self):
return self.name
Example 2: get_absolute_url django
def get_absolute_url(self):
from django.core.urlresolvers import reverse
return reverse('', kwargs={'pk': self.pk})