djagno create new data in model code example
Example 1: get_absolute_url django
def get_absolute_url(self):
from django.core.urlresolvers import reverse
return reverse('', kwargs={'pk': self.pk})
Example 2: str django
def __str__(self):
return self.name