diff --git a/src/agenda_culturel/forms.py b/src/agenda_culturel/forms.py index 3cb16c9..f93b4db 100644 --- a/src/agenda_culturel/forms.py +++ b/src/agenda_culturel/forms.py @@ -254,7 +254,14 @@ class EventForm(GroupFormMixin, ModelForm): self.fields['end_day'].group_id = 'end' self.fields['end_time'].group_id = 'end' - self.add_group('recurrences', _('This is a recurring event'), maskable=True, default_masked=True) + self.add_group('recurrences', + _('This is a recurring event'), + maskable=True, + default_masked=not (self.instance and + self.instance.recurrences and + self.instance.recurrences.rrules and + len(self.instance.recurrences.rrules) > 0)) + self.fields['recurrences'].group_id = 'recurrences' self.add_group('details', _('Details')) diff --git a/src/agenda_culturel/templates/agenda_culturel/forms/div_group.html b/src/agenda_culturel/templates/agenda_culturel/forms/div_group.html index 969e31f..43d7257 100644 --- a/src/agenda_culturel/templates/agenda_culturel/forms/div_group.html +++ b/src/agenda_culturel/templates/agenda_culturel/forms/div_group.html @@ -6,7 +6,13 @@ {% for group, fields in form.fields_by_group %}
{% if group.maskable %} - + {% endif %}
{% for field in fields %} @@ -36,7 +42,9 @@