Wednesday, March 21, 2018

Can anyone explain the overidding of save() of below code?

/* also explain super ().save() */

from django.db import models

class Blog(models.Model):
name = models.CharField(max_length=100)
tagline = models.TextField()

def save(self, *args, **kwargs):
do_something()
super(Blog, self).save(*args, **kwargs) # Call the "real" save() method.
do_something_else()

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3cd4d81a-2660-4b0c-aab1-2ef38cc65335%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment