Skip to content

Commit

Permalink
code style
Browse files Browse the repository at this point in the history
  • Loading branch information
MizukiTemma committed Feb 7, 2025
1 parent a2b93b5 commit 29251d3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
28 changes: 14 additions & 14 deletions integreat_cms/cms/forms/events/event_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,22 +189,22 @@ def clean(self) -> dict[str, Any]:
code="invalid",
),
)
elif end_date == start_date:
if (
end_date == start_date
and (start_time := cleaned_data.get("start_time"))
and (end_time := cleaned_data.get("end_time"))
and end_time < start_time
):
# If both dates are identical, check the times
if (
(start_time := cleaned_data.get("start_time"))
and (end_time := cleaned_data.get("end_time"))
and end_time < start_time
):
self.add_error(
"end_time",
forms.ValidationError(
_(
"The end of the event can't be before the start of the event",
),
code="invalid",
self.add_error(
"end_time",
forms.ValidationError(
_(
"The end of the event can't be before the start of the event",
),
)
code="invalid",
),
)

# If everything looks good until now, combine the dates and times into timezone-aware datetimes
if not self.errors:
Expand Down
2 changes: 1 addition & 1 deletion integreat_cms/cms/migrations/0113_alter_event_end.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


def remove_end_date_from_existing_events(
apps: Apps, schema_editor: BaseDatabaseSchemaEditor
apps: Apps, _schema_editor: BaseDatabaseSchemaEditor
) -> None:
"""
Set the end date of existing events equal to start date, if they have recurrence rule.
Expand Down

0 comments on commit 29251d3

Please sign in to comment.