Added updated at for applications

This commit is contained in:
gowtham 2022-05-23 23:18:09 +05:30
parent 1a692ec121
commit 4803b8366d
1 changed files with 2 additions and 0 deletions

View File

@ -120,11 +120,13 @@ class PlacementApplication(models.Model):
additional_info = models.JSONField(blank=True, null=True, default=None) additional_info = models.JSONField(blank=True, null=True, default=None)
selected = models.BooleanField(null=True, default=None, blank=True) selected = models.BooleanField(null=True, default=None, blank=True)
applied_at = models.DateTimeField(blank=False, default=None, null=True) applied_at = models.DateTimeField(blank=False, default=None, null=True)
updated_at = models.DateTimeField(blank=False, default=None, null=True)
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
''' On save, add timestamps ''' ''' On save, add timestamps '''
if not self.applied_at: if not self.applied_at:
self.applied_at = timezone.now() self.applied_at = timezone.now()
self.updated_at = timezone.now()
return super(PlacementApplication, self).save(*args, **kwargs) return super(PlacementApplication, self).save(*args, **kwargs)