manager: fix agenda's role edition when partial booking enabled (#85999)
gitea/chrono/pipeline/head This commit looks good Details

This commit is contained in:
Yann Weber 2024-01-23 14:39:03 +01:00 committed by Yann Weber
parent 3bfa450f97
commit a36369ae1c
2 changed files with 15 additions and 1 deletions

View File

@ -82,7 +82,7 @@ class AgendaAddForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if settings.PARTIAL_BOOKINGS_ENABLED:
if 'kind' in self.fields and settings.PARTIAL_BOOKINGS_ENABLED:
self.fields['kind'].choices += [('partial-bookings', _('Partial bookings'))]
class Meta:

View File

@ -479,6 +479,20 @@ def test_add_agenda_and_set_role(app, admin_user, manager_user):
assert agenda.desk_set.count() == 1
def test_agenda_set_role_with_partial_booking(settings, app, admin_user):
settings.PARTIAL_BOOKING_ENABLED = True
group = Group.objects.create(name='testgroup')
agenda = Agenda.objects.create(label='Foobar')
app = login(app)
resp = app.get('/manage/agendas/%s/settings' % agenda.id)
resp = resp.click('Configure', href='roles')
resp.form['edit_role'] = group.pk
resp = resp.form.submit().follow()
assert 'Edit Role: testgroup' in resp.text
def test_options_agenda_redirect(app, admin_user):
agenda = Agenda.objects.create(label='Foo Bar')