Skip to content

Python code snippet – How to override save method in django?

def save(self, *args, **kwargs):
	if not self.id:
	# Object is a new instance

	return super(Model, self).save(*args, **kwargs)
See also  TypeScript code snippet - How to configure email alerts in grafana container?
, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.