Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class RowInfo(models.Model):
- class Meta:
- abstract = True
- updated = models.DateTimeField(default=django.utils.timezone.now())
- created = models.DateTimeField(default=None)
- #updated = models.ForeignKey(settings.AUTH_USER_MODEL,on_delete=models.CASCADE)
- #created = models.ForeignKey(settings.AUTH_USER_MODEL,on_delete=models.CASCADE)
- def save(self, *args, **kwargs):
- print(self.id)
- self.updated = django.utils.timezone.now()
- operation = 'I' if self.id is None else 'U'
- if(operation == 'I'):
- print('Insert operation')
- self.created = django.utils.timezone.now()
- else:
- print('Update operation')
- super().save(*args, **kwargs)
- def delete(self):
- print(self.id)
- operation = 'D'
- print('Delete operation')
- super().delete()
- class Dicti(RowInfo):
- code = models.CharField(max_length=255,null=True,blank=True)
- numcode = models.IntegerField(null=True,blank=True)
- fullname = models.CharField(max_length=255)
- shortname = models.CharField(max_length=255)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement