You can use django-model-utils TimeStampedModel (you can also use django-extensions TimeStampedModel or make your own).
This provides every model a createdand modified. Then compare the timedelta between the fields of the new instance createdand modifiedwith an arbitrary time difference (in this example, 5 seconds are used). This allows you to determine if the instance is new:
def save(self, *args, **kwargs):
super(<ModelName>, self).save(*args, **kwargs)
if (self.modified - self.created).seconds < 5:
<the instance is new>
source
share