mirror of https://github.com/snachodog/mybuddy.git
Implement last_used
This commit is contained in:
parent
4fd55124f4
commit
f47d3c6b76
|
@ -2,6 +2,7 @@
|
|||
import re
|
||||
import time
|
||||
from datetime import timedelta
|
||||
from typing import Iterable, Optional
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.cache import cache
|
||||
|
@ -114,6 +115,12 @@ class BabyBuddyTagged(GenericTaggedItemBase):
|
|||
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):
|
||||
model_name = "child"
|
||||
first_name = models.CharField(max_length=255, verbose_name=_("First name"))
|
||||
|
|
Loading…
Reference in New Issue