Skip to content

Commit

Permalink
chore: fix pre-commit lints
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonGrace2282 committed Oct 5, 2024
1 parent b5cce88 commit 7de2cb9
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 14 deletions.
3 changes: 0 additions & 3 deletions intranet/apps/auth/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ def in_admin_group(user):
#: Restrict the wrapped view to eighth admins
eighth_admin_required = admin_required("eighth")

# Restrict the wrapped view to eighth sponsors
eighth_sponsor_required = user_passes_test(lambda u: not u.is_anonymous and u.is_eighth_sponsor)

#: Restrict the wrapped view to announcements admins
announcements_admin_required = admin_required("announcements")

Expand Down
4 changes: 2 additions & 2 deletions intranet/apps/eighth/forms/activities.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ def __init__(self, *args, sponsors=None, **kwargs):
self.fields["subscriptions_enabled"].label = "Enable club announcements"
self.fields["subscriptions_enabled"].help_text = "Allow students to subscribe to receive announcements for this activity through Ion."
self.fields["club_sponsors"].label = "Teacher moderators"

sponsors_list = "; ".join([str(sponsor) for sponsor in sponsors]) if sponsors else "no sponsors"

self.fields["club_sponsors"].help_text = (
f"Teacher moderators can post and manage this club's announcements. "
f"These are in addition to the activity's eighth period sponsors ({sponsors_list})."
Expand Down
6 changes: 3 additions & 3 deletions intranet/apps/eighth/forms/admin/activities.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ def __init__(self, *args, sponsors=None, **kwargs):
self.fields["subscriptions_enabled"].label = "Enable club announcements"
self.fields["subscriptions_enabled"].help_text = "Allow students to subscribe to receive announcements for this activity through Ion."
self.fields["officers"].help_text = "Student officers can send club announcements to subscribers."

sponsors_list = "; ".join([str(sponsor) for sponsor in sponsors]) if sponsors else "no sponsors"

self.fields["club_sponsors"].help_text = (
f"Teacher moderators can post and manage this club's announcements. "
f"These are in addition to the activity's eighth period sponsors ({sponsors_list})."
)

self.fields["club_sponsors"].label = "Teacher moderators"
self.fields["subscribers"].help_text = "Students who subscribe to this activity will receive club announcements."

Expand Down
6 changes: 2 additions & 4 deletions intranet/apps/eighth/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ class EighthSponsor(AbstractBaseEighthModel):
show_full_name = models.BooleanField(default=False)

history = HistoricalRecords()

def __str__(self):
return self.name

class Meta:
unique_together = (("first_name", "last_name", "user", "online_attendance", "full_time", "department"),)
ordering = ("last_name", "first_name")
Expand All @@ -108,9 +109,6 @@ def to_be_assigned(self) -> bool:
"""
return any(x in self.name.lower() for x in ["to be assigned", "to be determined", "to be announced"])

def __str__(self):
return self.name


class EighthRoom(AbstractBaseEighthModel):
"""Represents a room in which an eighth period activity can be held.
Expand Down
4 changes: 2 additions & 2 deletions intranet/apps/eighth/views/activities.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from ....utils.date import get_date_range_this_year, get_senior_graduation_year
from ....utils.helpers import is_entirely_digit
from ....utils.serialization import safe_json
from ...auth.decorators import deny_restricted, eighth_sponsor_required
from ...auth.decorators import deny_restricted
from ..forms.activities import ActivitySettingsForm
from ..forms.admin.activities import ActivityMultiSelectForm
from ..models import EighthActivity, EighthBlock, EighthScheduledActivity, EighthSignup, EighthSponsor
Expand Down Expand Up @@ -55,7 +55,7 @@ def activity_view(request, activity_id=None):
@login_required
def settings_view(request, activity_id=None):
activity = get_object_or_404(EighthActivity, id=activity_id)

if not (EighthSponsor.objects.filter(user=request.user).exists() or request.user in activity.club_sponsors.all()):
raise Http404

Expand Down

0 comments on commit 7de2cb9

Please sign in to comment.