mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 09:29:17 +02:00
See #170: subscriptions management UI
This commit is contained in:
parent
926a5cfc83
commit
be067b9ee3
13 changed files with 414 additions and 185 deletions
|
@ -410,15 +410,15 @@ def get_audio_mimetype(mt):
|
|||
return aliases.get(mt, mt)
|
||||
|
||||
|
||||
def update_modification_date(obj, field="modification_date"):
|
||||
def update_modification_date(obj, field="modification_date", date=None):
|
||||
IGNORE_DELAY = 60
|
||||
current_value = getattr(obj, field)
|
||||
now = timezone.now()
|
||||
ignore = current_value is not None and current_value < now - datetime.timedelta(
|
||||
date = date or timezone.now()
|
||||
ignore = current_value is not None and current_value < date - datetime.timedelta(
|
||||
seconds=IGNORE_DELAY
|
||||
)
|
||||
if ignore:
|
||||
setattr(obj, field, now)
|
||||
obj.__class__.objects.filter(pk=obj.pk).update(**{field: now})
|
||||
setattr(obj, field, date)
|
||||
obj.__class__.objects.filter(pk=obj.pk).update(**{field: date})
|
||||
|
||||
return now
|
||||
return date
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue