Compare commits
1 Commits
10074de603
...
e2343d0fe8
Author | SHA1 | Date |
---|---|---|
Frédéric Péters | e2343d0fe8 |
|
@ -3148,11 +3148,9 @@ class Booking(models.Model):
|
|||
with transaction.atomic():
|
||||
audit(
|
||||
'booking:cancel',
|
||||
_('cancellation of booking (%(booking_id)s) in event "%(event)s"')
|
||||
% {'booking_id': self.id, 'event': self.event},
|
||||
request=request,
|
||||
agenda=self.event.agenda,
|
||||
extra_data={'booking_id': self.id, 'event_id': self.event.id},
|
||||
extra_data={'booking_id': self.id, 'event': str(self.event), 'event_id': self.event.id},
|
||||
)
|
||||
self.secondary_booking_set.update(cancellation_datetime=timestamp)
|
||||
self.cancellation_datetime = timestamp
|
||||
|
@ -3177,10 +3175,10 @@ class Booking(models.Model):
|
|||
with transaction.atomic():
|
||||
audit(
|
||||
'check:reset',
|
||||
_('reset check of %(user)s in %(event)s') % {'user': self.user_name, 'event': self.event},
|
||||
request=request,
|
||||
agenda=self.event.agenda,
|
||||
extra_data={
|
||||
'event': str(self.event),
|
||||
'event_id': self.event.id,
|
||||
'user_name': self.user_name,
|
||||
},
|
||||
|
@ -3206,10 +3204,10 @@ class Booking(models.Model):
|
|||
with transaction.atomic():
|
||||
audit(
|
||||
'check:absence',
|
||||
_('marked absence of %(user)s in %(event)s') % {'user': self.user_name, 'event': self.event},
|
||||
request=request,
|
||||
agenda=self.event.agenda,
|
||||
extra_data={
|
||||
'event': str(self.event),
|
||||
'event_id': self.event.id,
|
||||
'user_name': self.user_name,
|
||||
},
|
||||
|
@ -3234,10 +3232,10 @@ class Booking(models.Model):
|
|||
with transaction.atomic():
|
||||
audit(
|
||||
'check:presence',
|
||||
_('marked presence of %(user)s in %(event)s') % {'user': self.user_name, 'event': self.event},
|
||||
request=request,
|
||||
agenda=self.event.agenda,
|
||||
extra_data={
|
||||
'event': str(self.event),
|
||||
'event_id': self.event.id,
|
||||
'user_name': self.user_name,
|
||||
},
|
||||
|
|
|
@ -1334,12 +1334,11 @@ class EventsAgendaFillslot(APIView):
|
|||
new_booking.save()
|
||||
audit(
|
||||
'booking:create',
|
||||
_('created a booking (%(booking_id)s) for event %(event)s')
|
||||
% {'booking_id': new_booking.id, 'event': event},
|
||||
request=request,
|
||||
agenda=event.agenda,
|
||||
extra_data={
|
||||
'booking_id': new_booking.id,
|
||||
'event': str(event),
|
||||
'event_id': event.id,
|
||||
'primary_booking_id': primary_booking.id if primary_booking else None,
|
||||
},
|
||||
|
@ -1584,12 +1583,11 @@ class MeetingsAgendaFillslot(APIView):
|
|||
booking.save()
|
||||
audit(
|
||||
'booking:create',
|
||||
_('created a booking (%(booking_id)s) for event %(event)s')
|
||||
% {'booking_id': booking.id, 'event': event},
|
||||
request=request,
|
||||
agenda=event.agenda,
|
||||
extra_data={
|
||||
'booking_id': booking.id,
|
||||
'event': str(event),
|
||||
'event_id': event.id,
|
||||
},
|
||||
)
|
||||
|
@ -2499,11 +2497,11 @@ class MultipleAgendasEventsCheckLock(APIView):
|
|||
)
|
||||
for event in events:
|
||||
audit(
|
||||
'check:%s' % ('lock' if check_locked else 'unlock'),
|
||||
message % {'event': event},
|
||||
'check:lock' if check_locked else 'check:unlock',
|
||||
request=request,
|
||||
agenda=event.agenda,
|
||||
extra_data={
|
||||
'event': str(event),
|
||||
'event_id': event.id,
|
||||
},
|
||||
)
|
||||
|
@ -2537,16 +2535,13 @@ class MultipleAgendasEventsInvoiced(APIView):
|
|||
)
|
||||
events.update(invoiced=invoiced)
|
||||
|
||||
message = (
|
||||
_('marked event %(event)s as invoiced') if invoiced else _('unmarked event %(event)s as invoiced')
|
||||
)
|
||||
for event in events:
|
||||
audit(
|
||||
'invoice:%s' % ('mark' if invoiced else 'unmark'),
|
||||
message % {'event': event},
|
||||
'invoice:mark' if invoiced else 'invoice:unmark',
|
||||
request=request,
|
||||
agenda=event.agenda,
|
||||
extra_data={
|
||||
'event': str(event),
|
||||
'event_id': event.id,
|
||||
},
|
||||
)
|
||||
|
@ -3043,12 +3038,11 @@ class AcceptBooking(APIView):
|
|||
event = booking.event
|
||||
audit(
|
||||
'booking:accept',
|
||||
_('acceptation of booking (%(booking_id)s) in event "%(event)s"')
|
||||
% {'booking_id': booking.id, 'event': event},
|
||||
request=request,
|
||||
agenda=event.agenda,
|
||||
extra_data={
|
||||
'booking_id': booking.id,
|
||||
'event': str(event),
|
||||
'event_id': event.id,
|
||||
},
|
||||
)
|
||||
|
@ -3087,10 +3081,13 @@ class SuspendBooking(APIView):
|
|||
event = booking.event
|
||||
audit(
|
||||
'booking:suspend',
|
||||
_('suspension of booking (%(booking_id)s) in event "%(event)s"')
|
||||
% {'booking_id': booking.id, 'event': event},
|
||||
request=request,
|
||||
agenda=event.agenda,
|
||||
extra_data={
|
||||
'booking_id': booking.id,
|
||||
'event': str(event),
|
||||
'event_id': event.id,
|
||||
},
|
||||
)
|
||||
|
||||
response = {'err': 0, 'booking_id': booking.pk}
|
||||
|
@ -3433,9 +3430,12 @@ class EventCheck(APIView):
|
|||
event.save(update_fields=['checked'])
|
||||
audit(
|
||||
'check:mark',
|
||||
_('marked event %(event)s as checked') % {'event': event},
|
||||
request=request,
|
||||
agenda=event.agenda,
|
||||
extra_data={
|
||||
'event': str(event),
|
||||
'event_id': event.id,
|
||||
},
|
||||
)
|
||||
event.async_notify_checked()
|
||||
response = {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Generated by Django 3.2.16 on 2024-04-22 10:59
|
||||
# Generated by Django 3.2.16 on 2024-04-23 11:49
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
|
@ -25,7 +25,6 @@ class Migration(migrations.Migration):
|
|||
('timestamp', models.DateTimeField(auto_now_add=True, verbose_name='Date')),
|
||||
('action_type', models.CharField(max_length=100, verbose_name='Action type')),
|
||||
('action_code', models.CharField(max_length=100, verbose_name='Action code')),
|
||||
('action_text', models.TextField()),
|
||||
('extra_data', models.JSONField(blank=True, default=dict)),
|
||||
(
|
||||
'agenda',
|
||||
|
|
|
@ -18,6 +18,22 @@ from django.conf import settings
|
|||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
MESSAGES = {
|
||||
'booking:accept': _('acceptation of booking (%(booking_id)s) in event "%(event)s"'),
|
||||
'booking:cancel': _('cancellation of booking (%(booking_id)s) in event "%(event)s"'),
|
||||
'booking:create': _('created booking (%(booking_id)s) for event %(event)s'),
|
||||
'booking:suspend': _('suspension of booking (%(booking_id)s) in event "%(event)s"'),
|
||||
'check:mark': _('marked event %(event)s as checked'),
|
||||
'check:mark-unchecked-absent': _('marked unchecked users as absent in %(event)s'),
|
||||
'check:reset': _('reset check of %(user_name)s in %(event)s'),
|
||||
'check:lock': _('marked event %(event)s as locked for checks'),
|
||||
'check:unlock': _('unmarked event %(event)s as locked for checks'),
|
||||
'check:absence': _('marked absence of %(user_name)s in %(event)s'),
|
||||
'check:presence': _('marked presence of %(user_name)s in %(event)s'),
|
||||
'invoice:mark': _('marked event %(event)s as invoiced'),
|
||||
'invoice:unmark': _('unmarked event %(event)s as invoiced'),
|
||||
}
|
||||
|
||||
|
||||
class AuditEntry(models.Model):
|
||||
timestamp = models.DateTimeField(verbose_name=_('Date'), auto_now_add=True)
|
||||
|
@ -26,7 +42,6 @@ class AuditEntry(models.Model):
|
|||
)
|
||||
action_type = models.CharField(verbose_name=_('Action type'), max_length=100)
|
||||
action_code = models.CharField(verbose_name=_('Action code'), max_length=100)
|
||||
action_text = models.TextField()
|
||||
agenda = models.ForeignKey(
|
||||
'agendas.Agenda', on_delete=models.SET_NULL, null=True, related_name='audit_entries'
|
||||
)
|
||||
|
@ -34,3 +49,9 @@ class AuditEntry(models.Model):
|
|||
|
||||
class Meta:
|
||||
ordering = ('-timestamp',)
|
||||
|
||||
def get_action_text(self):
|
||||
try:
|
||||
return MESSAGES[f'{self.action_type}:{self.action_code}'] % self.extra_data
|
||||
except KeyError:
|
||||
return _('Unknown entry (%s:%s)') % (self.action_type, self.action_code)
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<td>{{ line.timestamp }}</td>
|
||||
<td>{{ line.user.get_full_name }}</td>
|
||||
<td>{{ line.agenda }}</td>
|
||||
<td>{{ line.action_text }}</td>
|
||||
<td>{{ line.get_action_text }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
|
|
@ -17,13 +17,12 @@
|
|||
from .models import AuditEntry
|
||||
|
||||
|
||||
def audit(action, action_text, request=None, user=None, agenda=None, extra_data=None):
|
||||
def audit(action, request=None, user=None, agenda=None, extra_data=None):
|
||||
action_type, action_code = action.split(':', 1)
|
||||
return AuditEntry.objects.create(
|
||||
user=request.user if request else user,
|
||||
action_type=action_type,
|
||||
action_code=action_code,
|
||||
action_text=action_text,
|
||||
agenda=agenda,
|
||||
extra_data=extra_data or {},
|
||||
)
|
||||
|
|
|
@ -3339,7 +3339,6 @@ class EventPresenceView(EventCheckMixin, ViewableAgendaMixin, FormView):
|
|||
with transaction.atomic():
|
||||
audit(
|
||||
'check:mark-unchecked-present',
|
||||
_('marked unchecked users as present in %(event)s') % {'event': self.event},
|
||||
request=request,
|
||||
agenda=self.event.agenda,
|
||||
extra_data={
|
||||
|
@ -3381,10 +3380,10 @@ class EventAbsenceView(EventCheckMixin, ViewableAgendaMixin, FormView):
|
|||
with transaction.atomic():
|
||||
audit(
|
||||
'check:mark-unchecked-absent',
|
||||
_('marked unchecked users as absent in %(event)s') % {'event': self.event},
|
||||
request=request,
|
||||
agenda=self.event.agenda,
|
||||
extra_data={
|
||||
'event': str(self.event),
|
||||
'event_id': self.event.id,
|
||||
'check_type_slug': qs_kwargs['type_slug'],
|
||||
},
|
||||
|
@ -3406,10 +3405,10 @@ class EventCheckedView(EventCheckMixin, ViewableAgendaMixin, View):
|
|||
self.event.save(update_fields=['checked'])
|
||||
audit(
|
||||
'check:mark',
|
||||
_('marked %(event)s as checked') % {'event': self.event},
|
||||
request=request,
|
||||
agenda=self.agenda,
|
||||
extra_data={
|
||||
'event': str(self.event),
|
||||
'event_id': self.event.id,
|
||||
},
|
||||
)
|
||||
|
|
|
@ -4,6 +4,7 @@ import pytest
|
|||
from pyquery import PyQuery
|
||||
|
||||
from chrono.agendas.models import Agenda
|
||||
from chrono.apps.journal.models import AuditEntry
|
||||
from chrono.apps.journal.utils import audit
|
||||
from chrono.utils.timezone import make_aware
|
||||
from tests.utils import login
|
||||
|
@ -47,29 +48,22 @@ def test_journal_browse(app, admin_user, manager_user, settings):
|
|||
user = admin_user if i % 3 else manager_user
|
||||
agenda = agendas[i % 3]
|
||||
|
||||
entry = audit('booking:cancel', 'cancellation of booking (%s)' % i, user=user, agenda=agenda)
|
||||
entry = audit(
|
||||
'booking:cancel',
|
||||
user=user,
|
||||
agenda=agenda,
|
||||
extra_data={'booking_id': 1, 'event': 'foobar', 'event_id': 1},
|
||||
)
|
||||
entry.timestamp = make_aware(
|
||||
datetime.datetime(
|
||||
2024,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
)
|
||||
+ datetime.timedelta(days=i, hours=i, minutes=i)
|
||||
datetime.datetime(2024, 1, 1) + datetime.timedelta(days=i, hours=i, minutes=i)
|
||||
)
|
||||
entry.save()
|
||||
|
||||
entry = audit('check:absence', 'marked absence (%s)' % i, user=user, agenda=agenda)
|
||||
entry = audit(
|
||||
'check:absence', user=user, agenda=agenda, extra_data={'user_name': 'User', 'event': 'foobar'}
|
||||
)
|
||||
entry.timestamp = make_aware(
|
||||
datetime.datetime(
|
||||
2024,
|
||||
1,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
)
|
||||
+ datetime.timedelta(days=i, hours=i, minutes=i)
|
||||
datetime.datetime(2024, 1, 2) + datetime.timedelta(days=i, hours=i, minutes=i)
|
||||
)
|
||||
entry.save()
|
||||
|
||||
|
@ -77,31 +71,31 @@ def test_journal_browse(app, admin_user, manager_user, settings):
|
|||
resp = app.get('/manage/journal/')
|
||||
|
||||
assert [[x.text for x in PyQuery(x).find('td')] for x in resp.pyquery('tbody tr')] == [
|
||||
['Jan. 21, 2024, 7:19 p.m.', 'Admin', 'Bar', 'marked absence (19)'],
|
||||
['Jan. 20, 2024, 7:19 p.m.', 'Admin', 'Bar', 'cancellation of booking (19)'],
|
||||
['Jan. 20, 2024, 6:18 p.m.', 'Manager', 'Foo', 'marked absence (18)'],
|
||||
['Jan. 19, 2024, 6:18 p.m.', 'Manager', 'Foo', 'cancellation of booking (18)'],
|
||||
['Jan. 19, 2024, 5:17 p.m.', 'Admin', 'Baz', 'marked absence (17)'],
|
||||
['Jan. 18, 2024, 5:17 p.m.', 'Admin', 'Baz', 'cancellation of booking (17)'],
|
||||
['Jan. 18, 2024, 4:16 p.m.', 'Admin', 'Bar', 'marked absence (16)'],
|
||||
['Jan. 17, 2024, 4:16 p.m.', 'Admin', 'Bar', 'cancellation of booking (16)'],
|
||||
['Jan. 17, 2024, 3:15 p.m.', 'Manager', 'Foo', 'marked absence (15)'],
|
||||
['Jan. 16, 2024, 3:15 p.m.', 'Manager', 'Foo', 'cancellation of booking (15)'],
|
||||
['Jan. 21, 2024, 7:19 p.m.', 'Admin', 'Bar', 'marked absence of User in foobar'],
|
||||
['Jan. 20, 2024, 7:19 p.m.', 'Admin', 'Bar', 'cancellation of booking (1) in event "foobar"'],
|
||||
['Jan. 20, 2024, 6:18 p.m.', 'Manager', 'Foo', 'marked absence of User in foobar'],
|
||||
['Jan. 19, 2024, 6:18 p.m.', 'Manager', 'Foo', 'cancellation of booking (1) in event "foobar"'],
|
||||
['Jan. 19, 2024, 5:17 p.m.', 'Admin', 'Baz', 'marked absence of User in foobar'],
|
||||
['Jan. 18, 2024, 5:17 p.m.', 'Admin', 'Baz', 'cancellation of booking (1) in event "foobar"'],
|
||||
['Jan. 18, 2024, 4:16 p.m.', 'Admin', 'Bar', 'marked absence of User in foobar'],
|
||||
['Jan. 17, 2024, 4:16 p.m.', 'Admin', 'Bar', 'cancellation of booking (1) in event "foobar"'],
|
||||
['Jan. 17, 2024, 3:15 p.m.', 'Manager', 'Foo', 'marked absence of User in foobar'],
|
||||
['Jan. 16, 2024, 3:15 p.m.', 'Manager', 'Foo', 'cancellation of booking (1) in event "foobar"'],
|
||||
]
|
||||
|
||||
resp = resp.click('2') # pagination
|
||||
|
||||
assert [[x.text for x in PyQuery(x).find('td')] for x in resp.pyquery('tbody tr')] == [
|
||||
['Jan. 16, 2024, 2:14 p.m.', 'Admin', 'Baz', 'marked absence (14)'],
|
||||
['Jan. 15, 2024, 2:14 p.m.', 'Admin', 'Baz', 'cancellation of booking (14)'],
|
||||
['Jan. 15, 2024, 1:13 p.m.', 'Admin', 'Bar', 'marked absence (13)'],
|
||||
['Jan. 14, 2024, 1:13 p.m.', 'Admin', 'Bar', 'cancellation of booking (13)'],
|
||||
['Jan. 14, 2024, 12:12 p.m.', 'Manager', 'Foo', 'marked absence (12)'],
|
||||
['Jan. 13, 2024, 12:12 p.m.', 'Manager', 'Foo', 'cancellation of booking (12)'],
|
||||
['Jan. 13, 2024, 11:11 a.m.', 'Admin', 'Baz', 'marked absence (11)'],
|
||||
['Jan. 12, 2024, 11:11 a.m.', 'Admin', 'Baz', 'cancellation of booking (11)'],
|
||||
['Jan. 12, 2024, 10:10 a.m.', 'Admin', 'Bar', 'marked absence (10)'],
|
||||
['Jan. 11, 2024, 10:10 a.m.', 'Admin', 'Bar', 'cancellation of booking (10)'],
|
||||
['Jan. 16, 2024, 2:14 p.m.', 'Admin', 'Baz', 'marked absence of User in foobar'],
|
||||
['Jan. 15, 2024, 2:14 p.m.', 'Admin', 'Baz', 'cancellation of booking (1) in event "foobar"'],
|
||||
['Jan. 15, 2024, 1:13 p.m.', 'Admin', 'Bar', 'marked absence of User in foobar'],
|
||||
['Jan. 14, 2024, 1:13 p.m.', 'Admin', 'Bar', 'cancellation of booking (1) in event "foobar"'],
|
||||
['Jan. 14, 2024, 12:12 p.m.', 'Manager', 'Foo', 'marked absence of User in foobar'],
|
||||
['Jan. 13, 2024, 12:12 p.m.', 'Manager', 'Foo', 'cancellation of booking (1) in event "foobar"'],
|
||||
['Jan. 13, 2024, 11:11 a.m.', 'Admin', 'Baz', 'marked absence of User in foobar'],
|
||||
['Jan. 12, 2024, 11:11 a.m.', 'Admin', 'Baz', 'cancellation of booking (1) in event "foobar"'],
|
||||
['Jan. 12, 2024, 10:10 a.m.', 'Admin', 'Bar', 'marked absence of User in foobar'],
|
||||
['Jan. 11, 2024, 10:10 a.m.', 'Admin', 'Bar', 'cancellation of booking (1) in event "foobar"'],
|
||||
]
|
||||
|
||||
# filters
|
||||
|
@ -109,15 +103,15 @@ def test_journal_browse(app, admin_user, manager_user, settings):
|
|||
resp.form['timestamp'].value = '2024-01-19'
|
||||
resp = resp.form.submit()
|
||||
assert [[x.text for x in PyQuery(x).find('td')] for x in resp.pyquery('tbody tr')] == [
|
||||
['Jan. 19, 2024, 6:18 p.m.', 'Manager', 'Foo', 'cancellation of booking (18)'],
|
||||
['Jan. 19, 2024, 5:17 p.m.', 'Admin', 'Baz', 'marked absence (17)'],
|
||||
['Jan. 19, 2024, 6:18 p.m.', 'Manager', 'Foo', 'cancellation of booking (1) in event "foobar"'],
|
||||
['Jan. 19, 2024, 5:17 p.m.', 'Admin', 'Baz', 'marked absence of User in foobar'],
|
||||
]
|
||||
|
||||
assert resp.form['timestamp'].value == '2024-01-19'
|
||||
resp.form['agenda'].value = agendas[0].id
|
||||
resp = resp.form.submit()
|
||||
assert [[x.text for x in PyQuery(x).find('td')] for x in resp.pyquery('tbody tr')] == [
|
||||
['Jan. 19, 2024, 6:18 p.m.', 'Manager', 'Foo', 'cancellation of booking (18)']
|
||||
['Jan. 19, 2024, 6:18 p.m.', 'Manager', 'Foo', 'cancellation of booking (1) in event "foobar"']
|
||||
]
|
||||
|
||||
resp.form['agenda'].value = agendas[1].id
|
||||
|
@ -128,11 +122,45 @@ def test_journal_browse(app, admin_user, manager_user, settings):
|
|||
resp.form['action_type'].value = 'booking'
|
||||
resp = resp.form.submit()
|
||||
assert [[x.text for x in PyQuery(x).find('td')] for x in resp.pyquery('tbody tr')] == [
|
||||
['Jan. 20, 2024, 7:19 p.m.', 'Admin', 'Bar', 'cancellation of booking (19)'],
|
||||
['Jan. 17, 2024, 4:16 p.m.', 'Admin', 'Bar', 'cancellation of booking (16)'],
|
||||
['Jan. 14, 2024, 1:13 p.m.', 'Admin', 'Bar', 'cancellation of booking (13)'],
|
||||
['Jan. 11, 2024, 10:10 a.m.', 'Admin', 'Bar', 'cancellation of booking (10)'],
|
||||
['Jan. 8, 2024, 7:07 a.m.', 'Admin', 'Bar', 'cancellation of booking (7)'],
|
||||
['Jan. 5, 2024, 4:04 a.m.', 'Admin', 'Bar', 'cancellation of booking (4)'],
|
||||
['Jan. 2, 2024, 1:01 a.m.', 'Admin', 'Bar', 'cancellation of booking (1)'],
|
||||
['Jan. 20, 2024, 7:19 p.m.', 'Admin', 'Bar', 'cancellation of booking (1) in event "foobar"'],
|
||||
['Jan. 17, 2024, 4:16 p.m.', 'Admin', 'Bar', 'cancellation of booking (1) in event "foobar"'],
|
||||
['Jan. 14, 2024, 1:13 p.m.', 'Admin', 'Bar', 'cancellation of booking (1) in event "foobar"'],
|
||||
['Jan. 11, 2024, 10:10 a.m.', 'Admin', 'Bar', 'cancellation of booking (1) in event "foobar"'],
|
||||
['Jan. 8, 2024, 7:07 a.m.', 'Admin', 'Bar', 'cancellation of booking (1) in event "foobar"'],
|
||||
['Jan. 5, 2024, 4:04 a.m.', 'Admin', 'Bar', 'cancellation of booking (1) in event "foobar"'],
|
||||
['Jan. 2, 2024, 1:01 a.m.', 'Admin', 'Bar', 'cancellation of booking (1) in event "foobar"'],
|
||||
]
|
||||
|
||||
|
||||
def test_journal_browse_invalid_or_unknown_event(app, admin_user, settings):
|
||||
settings.AUDIT_JOURNAL_ENABLED = True
|
||||
admin_user.first_name = 'Admin'
|
||||
admin_user.save()
|
||||
AuditEntry.objects.all().delete()
|
||||
|
||||
agenda = Agenda.objects.create(label='Foo', kind='events')
|
||||
entry = audit(
|
||||
'booking:cancel',
|
||||
user=admin_user,
|
||||
agenda=agenda,
|
||||
extra_data={'event': 'foobar', 'event_id': 1}, # missing booking_id
|
||||
)
|
||||
entry.timestamp = make_aware(datetime.datetime(2024, 1, 1))
|
||||
entry.save()
|
||||
resp = login(app).get('/manage/journal/')
|
||||
assert [[x.text for x in PyQuery(x).find('td')] for x in resp.pyquery('tbody tr')] == [
|
||||
['Jan. 1, 2024, midnight', 'Admin', 'Foo', 'Unknown entry (booking:cancel)']
|
||||
]
|
||||
|
||||
AuditEntry.objects.all().delete()
|
||||
entry = audit(
|
||||
'foo:bar',
|
||||
user=admin_user,
|
||||
agenda=agenda,
|
||||
)
|
||||
entry.timestamp = make_aware(datetime.datetime(2024, 1, 1))
|
||||
entry.save()
|
||||
resp = login(app).get('/manage/journal/')
|
||||
assert [[x.text for x in PyQuery(x).find('td')] for x in resp.pyquery('tbody tr')] == [
|
||||
['Jan. 1, 2024, midnight', 'Admin', 'Foo', 'Unknown entry (foo:bar)']
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue