jango views save through models 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: super in django manager

# First, define the Manager subclass.
class DahlBookManager(models.Manager):
    def get_queryset(self):
        return super().get_queryset().filter(author='Roald Dahl')

# Then hook it into the Book model explicitly.
class Book(models.Model):
    title = models.CharField(max_length=100)
    author = models.CharField(max_length=50)

    objects = models.Manager() # The default manager.
    dahl_objects = DahlBookManager() # The Dahl-specific manager.