1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-04-15 03:12:16 +00:00

Merge branch 'time-display' into 'main'

Fixed some non timezone-aware displays

See merge request bde/nk20!303
This commit is contained in:
nicomarg 2025-04-04 06:38:35 +02:00
commit b3c4388a3f
2 changed files with 3 additions and 2 deletions

View File

@ -201,7 +201,8 @@ class Entry(models.Model):
def save(self, *args, **kwargs):
qs = Entry.objects.filter(~Q(pk=self.pk), activity=self.activity, note=self.note, guest=self.guest)
if qs.exists():
raise ValidationError(_("Already entered on ") + _("{:%Y-%m-%d %H:%M:%S}").format(qs.get().time, ))
raise ValidationError(_("Already entered on ") +
_("{:%Y-%m-%d %H:%M:%S}").format(timezone.localtime(qs.get().time), ))
if self.guest:
self.note = self.guest.inviter

View File

@ -55,7 +55,7 @@ class GuestTable(tables.Table):
def render_entry(self, record):
if record.has_entry:
return str(_("Entered on ") + str(_("{:%Y-%m-%d %H:%M:%S}").format(record.entry.time, )))
return str(_("Entered on ") + str(_("{:%Y-%m-%d %H:%M:%S}").format(timezone.localtime(record.entry.time))))
return mark_safe('<button id="{id}" class="btn btn-danger btn-sm" onclick="remove_guest(this.id)"> '
'{delete_trans}</button>'.format(id=record.id, delete_trans=_("remove").capitalize()))