Skip to content

Commit

Permalink
Add icon for interestgroups to frontpage
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterJFB committed Mar 22, 2022
1 parent a8ae58b commit bc94c24
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lego/apps/frontpage/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
DetailedPollSerializer,
HiddenResultsDetailedPollSerializer,
)
from lego.apps.users.models import AbakusGroup
from lego.apps.users.serializers.abakus_groups import PublicAbakusGroupSerializer
from lego.apps.users.constants import GROUP_INTEREST


class FrontpageViewSet(viewsets.ViewSet):
Expand Down Expand Up @@ -90,6 +93,8 @@ def get_serializer_context():

queryset_poll = Poll.objects.filter(pinned=True).order_by("created_at").last()

queryset_interestgroups = AbakusGroup.objects.filter(type=GROUP_INTEREST, active=True).order_by("?")

articles = PublicArticleSerializer(
queryset_articles[:10], context=get_serializer_context(), many=True
).data
Expand All @@ -106,7 +111,15 @@ def get_serializer_context():
poll = DetailedPollSerializer(
queryset_poll, context=get_serializer_context()
).data
interestgroups = PublicAbakusGroupSerializer(
queryset_interestgroups[:3], context=get_serializer_context(), many=True
).data

ret = {"articles": articles, "events": events, "poll": poll}
ret = {
"articles": articles,
"events": events,
"poll": poll,
"interestgroups": interestgroups,
}

return Response(ret)

0 comments on commit bc94c24

Please sign in to comment.