diff --git a/src/agenda_culturel/forms.py b/src/agenda_culturel/forms.py index 7c8da7a..26a666b 100644 --- a/src/agenda_culturel/forms.py +++ b/src/agenda_culturel/forms.py @@ -112,6 +112,8 @@ class EventForm(ModelForm): if not is_authenticated: del self.fields["status"] self.fields['category'].queryset = self.fields['category'].queryset.order_by('name') + self.fields['category'].empty_label = None + self.fields['category'].initial = Category.get_default_category() def clean_end_day(self): start_day = self.cleaned_data.get("start_day") diff --git a/src/agenda_culturel/views.py b/src/agenda_culturel/views.py index a354a47..330ac21 100644 --- a/src/agenda_culturel/views.py +++ b/src/agenda_culturel/views.py @@ -609,6 +609,11 @@ class EventCreateView(SuccessMessageMixin, CreateView): success_message = _("The event has been submitted and will be published as soon as it has been validated by the moderation team.") form_class = EventForm + def get_form_kwargs(self): + kwargs = super().get_form_kwargs() + kwargs["is_authenticated"] = self.request.user.is_authenticated + return kwargs + def import_from_details(request): form = EventForm(request.POST, is_authenticated=request.user.is_authenticated)