From d7dcd02ede9012e02d4e81e1c23ab00b56a3181c Mon Sep 17 00:00:00 2001 From: Zergling_man Date: Sun, 12 Dec 2021 19:58:36 +1100 Subject: [PATCH] That's a handy function --- main/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/models.py b/main/models.py index b1b1e09..7c84eb9 100644 --- a/main/models.py +++ b/main/models.py @@ -21,7 +21,7 @@ class Contact(models.Model): priority=models.IntegerField() def save(self,*args,**kwargs): - a=Updates.objects.get(page='contact') + a,_=Updates.objects.get_or_create(page='contact') a.date=date.today() a.save() super().save(*args,**kwargs)