intranet.apps.dashboard package¶
Submodules¶
intranet.apps.dashboard.tests module¶
intranet.apps.dashboard.views module¶
- class intranet.apps.dashboard.views.RawPaginationData[source]¶
Bases:
TypedDict
,Generic
[T
]- club_items: Sequence[Announcement]¶
- page_obj: Paginator[T]¶
- intranet.apps.dashboard.views.add_widgets_context(request, context)[source]¶
WIDGETS: * Eighth signup (STUDENT) * Eighth attendance (TEACHER or ADMIN) * Enrichment activities (ALL if enrichment activity today) * Bell schedule (ALL) * Administration (ADMIN) * Links (ALL) * Seniors (STUDENT; graduation countdown if senior, link to destinations otherwise) if settings.ENABLE_SENIOR_DESTINATIONS
- intranet.apps.dashboard.views.dashboard_view(request, show_widgets=True, show_expired=False, show_hidden_club=False, ignore_dashboard_types=None, show_welcome=False)[source]¶
Process and show the dashboard, which includes activities, events, and widgets.
- intranet.apps.dashboard.views.filter_club_announcements(user, user_hidden_announcements: QuerySet[Announcement], club_items: Iterable[Announcement]) tuple[list[Announcement], list[Announcement], list[Announcement]] [source]¶
Filter club announcements into categories
- Returns:
a tuple of visible, hidden, and unsubscribed club announcements for the user.
- intranet.apps.dashboard.views.gen_schedule(user, num_blocks: int = 6, surrounding_blocks: Iterable[EighthBlock] | None = None)[source]¶
Generate a list of information about a block and a student’s current activity signup.
- Returns:
schedule no_signup_today
- intranet.apps.dashboard.views.gen_sponsor_schedule(user, sponsor=None, num_blocks: int = 6, surrounding_blocks=None, given_date=None)[source]¶
Return a list of
EighthScheduledActivity
s in which the given user is sponsoring.- Returns:
activities no_attendance_today num_acts
- Return type:
Dictionary with
- intranet.apps.dashboard.views.get_announcements_list(request, context) list[Announcement | Event] [source]¶
An announcement will be shown if: * It is not expired
unless ?show_expired=1
It is visible to the user
There are no groups on the announcement (so it is public)
The user’s groups are in union with the groups on the announcement (at least one matches)
The user submitted the announcement directly
The user submitted the announcement through a request
The user approved the announcement through a request
…unless ?show_all=1
An event will be shown if: * It is not expired
unless ?show_expired=1
It is approved
unless an events admin
It is visible to the user
There are no groups
The groups are in union
- intranet.apps.dashboard.views.paginate_announcements_list(request, context: dict[str, Any], items: Sequence[T], visible_club_items: Sequence[Announcement] = ()) tuple[dict[str, Any], Page[T]] [source]¶
Paginate
items
in groups of 15- Returns:
A tuple of the updated context and the page.
- intranet.apps.dashboard.views.paginate_announcements_list_raw(request: HttpRequest, items: Sequence[T], visible_club_items: Sequence[Announcement] = (), *, query_param: str = 'page') RawPaginationData[T] [source]¶
Return the raw data for paginating announcements.
- Parameters:
request – The
django.http.HttpRequest
object.items – The list of items to paginate.
visible_club_items – The list of club announcements to paginate and add to the context.
query_param – The
request.GET
parameter to use for the page number.
- Returns:
A dictionary intended to be merged into the context.
- intranet.apps.dashboard.views.split_club_announcements(items: Iterable[Announcement | Event]) tuple[list[Announcement], list[Announcement]] [source]¶
Split items into standard and club announcements.
Warning
This will discard any club announcements with subscriptions disabled from the resulting list.
- Returns:
a tuple of standard and club announcements.