diff --git a/aleksis/core/models.py b/aleksis/core/models.py index de891da1bab9bbc37da9c95493fea9efc81db99d..b50742f972c05c73e67ff1551c5222d7bac70275 100644 --- a/aleksis/core/models.py +++ b/aleksis/core/models.py @@ -312,15 +312,12 @@ class AnnouncementQuerySet(models.QuerySet): return announcements - def for_person_at_time(self, person: Person, when: Optional[datetime] = None) -> List: - """ Get all announcements for one person at a certain time """ - - # Get announcements by time - announcements = self.at_time(when) + def for_person(self, person: Person) -> List: + """ Get all announcements for one person """ # Filter by person announcements_for_person = [] - for announcement in announcements: + for announcement in self: if person in announcement.recipient_persons: announcements_for_person.append(announcement) diff --git a/aleksis/core/views.py b/aleksis/core/views.py index 662a1a040ec64b302be36de2fa0a5d36592330fb..1bdbd632dad7ff51488d8541d65386e8e8be8fdc 100644 --- a/aleksis/core/views.py +++ b/aleksis/core/views.py @@ -34,7 +34,7 @@ def index(request: HttpRequest) -> HttpResponse: context["notifications"] = notifications context["unread_notifications"] = unread_notifications - announcements = Announcement.objects.for_person_at_time(request.user.person) + announcements = Announcement.objects.at_time().for_person(request.user.person) context["announcements"] = announcements widgets = DashboardWidget.objects.filter(active=True)