Move to using inline todos, update .dockerignore, and remove duplicate timezone records in seed data

This commit is contained in:
Keannu Christian Bernasol 2024-11-13 17:43:36 +08:00
parent b024a74364
commit f7b949a45e
7 changed files with 40 additions and 29 deletions

View file

@ -1,11 +1,17 @@
from django.core.cache import cache
from django.db import models
class Notification(models.Model):
recipient = models.ForeignKey("accounts.CustomUser", on_delete=models.CASCADE)
recipient = models.ForeignKey(
"accounts.CustomUser", on_delete=models.CASCADE)
content = models.CharField(max_length=1000, null=True)
timestamp = models.DateTimeField(auto_now_add=True, editable=False)
dismissed = models.BooleanField(default=False)
def __str__(self):
return self.content
def save(self, **kwargs):
cache.delete(f"notifications_user:{self.recipient.id}")
super().save(**kwargs)