Skip to content

Commit

Permalink
Fixup. Format code with Black
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions authored and vsabatie committed Nov 22, 2023
1 parent 85cd1f4 commit c9130bd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 13 deletions.
29 changes: 19 additions & 10 deletions pod/meeting/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ def get_rounded_time():
(
"main_fields",
{
"legend": ('<i class="bi bi-gear" aria-hidden="true"></i> %s' % _("Main fields")),
"legend": (
'<i class="bi bi-gear" aria-hidden="true"></i> %s' % _("Main fields")
),
"fields": MEETING_MAIN_FIELDS,
},
),
Expand Down Expand Up @@ -248,26 +250,30 @@ def clean_start_date(self):
- the start date is before the recurrence deadline.
- in the case of weekly recurrence, the start day must be selected from the list of weekdays.
The function raise a validation error if a condition is not met."""
if ("start" in self.cleaned_data.keys()
if (
"start" in self.cleaned_data.keys()
and "recurring_until" in self.cleaned_data.keys()
and self.cleaned_data["recurring_until"] is not None
and (
self.cleaned_data["start"] > self.cleaned_data["recurring_until"]
)):
and (self.cleaned_data["start"] > self.cleaned_data["recurring_until"])
):
raise ValidationError(_("Start date must be less than recurring until date"))

if (self.cleaned_data.get("weekdays")
if (
self.cleaned_data.get("weekdays")
and self.cleaned_data.get("start")
and self.cleaned_data.get("recurrence") == "weekly"
and (
str(self.cleaned_data.get("start").weekday())
not in self.cleaned_data.get("weekdays")
)):
)
):
raise ValidationError(
_("In case of weekly recurring, the day of the start date must be selected.")
_(
"In case of weekly recurring, the day of the start date must be selected."
)
)

if not self.cleaned_data.get('recurring_until'):
if not self.cleaned_data.get("recurring_until"):
self.instance.recurring_until = None

def clean_add_owner(self):
Expand Down Expand Up @@ -310,7 +316,10 @@ def clean(self):
):
self.cleaned_data["is_restricted"] = True

if "start_time" in self.cleaned_data.keys() and "start" in self.cleaned_data.keys():
if (
"start_time" in self.cleaned_data.keys()
and "start" in self.cleaned_data.keys()
):
start_time = datetime.datetime.strptime(
self.cleaned_data["start_time"], "%H:%M:%S"
).time()
Expand Down
4 changes: 2 additions & 2 deletions pod/meeting/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ class Meeting(models.Model):
)

INTERVAL_CHOICES = (
('', '%s' % _("Choose repeat frequency")),
('-- %s --' % _("Frequency"), INTERVAL_FREQUENCIES),
("", "%s" % _("Choose repeat frequency")),
("-- %s --" % _("Frequency"), INTERVAL_FREQUENCIES),
)

DATE_DAY, NTH_DAY = "date_day", "nth_day"
Expand Down
6 changes: 5 additions & 1 deletion pod/meeting/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,11 @@ def add_or_edit(request, meeting_id=None):
return render(
request,
"meeting/add_or_edit.html",
{"form": form, "start_date_formats": start_date_formats, "page_title": mark_safe(page_title)},
{
"form": form,
"start_date_formats": start_date_formats,
"page_title": mark_safe(page_title),
},
)


Expand Down

0 comments on commit c9130bd

Please sign in to comment.