diff options
author | Sunil Shetye | 2025-04-06 19:18:21 +0530 |
---|---|---|
committer | Sunil Shetye | 2025-04-07 15:38:16 +0530 |
commit | ebfe6faf5172cd7caac108db6e89fac02ecfc9aa (patch) | |
tree | 3f434e89cec73a6461c5f75e4e11684c687efa24 | |
parent | 944f7b210c29bdafbfeba7323d6b6a3ad8983b81 (diff) | |
download | Common-Interface-Project-ebfe6faf5172cd7caac108db6e89fac02ecfc9aa.tar.gz Common-Interface-Project-ebfe6faf5172cd7caac108db6e89fac02ecfc9aa.tar.bz2 Common-Interface-Project-ebfe6faf5172cd7caac108db6e89fac02ecfc9aa.zip |
set expire_at as per current time
-rw-r--r-- | blocks/simulationAPI/models.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/blocks/simulationAPI/models.py b/blocks/simulationAPI/models.py index 2a121941..65251dd1 100644 --- a/blocks/simulationAPI/models.py +++ b/blocks/simulationAPI/models.py @@ -24,11 +24,15 @@ TASK_STATUS_CHOICES = [ ] +def get_expire_at(): + return timezone.now() + timedelta(days=1) + + class Session(models.Model): session_id = models.CharField(primary_key=True, max_length=40, null=False, editable=False) app_name = models.CharField(max_length=40, blank=False, null=False, default='') created_at = models.DateTimeField(auto_now_add=True) - expire_at = models.DateTimeField(default=timezone.now() + timedelta(days=1)) + expire_at = models.DateTimeField(default=get_expire_at) count = models.IntegerField(null=False, default=0) def save(self, *args, **kwargs): |