Implement last_used

This commit is contained in:
Paul Konstantin Gerke 2022-02-20 12:40:06 +01:00
parent 4fd55124f4
commit f47d3c6b76
1 changed files with 7 additions and 0 deletions

View File

@ -2,6 +2,7 @@
import re import re
import time import time
from datetime import timedelta from datetime import timedelta
from typing import Iterable, Optional
from django.conf import settings from django.conf import settings
from django.core.cache import cache from django.core.cache import cache
@ -114,6 +115,12 @@ class BabyBuddyTagged(GenericTaggedItemBase):
related_name="%(app_label)s_%(class)s_items", related_name="%(app_label)s_%(class)s_items",
) )
def save_base(self, *args, **kwargs):
self.tag.last_used = now()
self.tag.save()
return super().save_base(*args, **kwargs)
class Child(models.Model): class Child(models.Model):
model_name = "child" model_name = "child"
first_name = models.CharField(max_length=255, verbose_name=_("First name")) first_name = models.CharField(max_length=255, verbose_name=_("First name"))