diff --git a/CHANGELOG.md b/CHANGELOG.md
index c85b40c4e..0cbc8b0c2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,7 @@
- ⚡ **Venteliste** Brukere på venteliste kan nå se sin egen plass på ventelisten.
- ✨ **QR Kode** Brukere kan nå generere sine egne QR koder.
- ⚡ **Endring av arrangement plasser** Venteliste og liste vil nå bli automatisk oppdatert hvis man endrer på antall plasser på et arrangement.
+- ✨ **Aktiviteter** Arrangementer kan nå filtreres på aktiviteter.
## Versjon 2023.10.23
- ⚡ **Brukere** HS kan styre medlemmer
diff --git a/app/content/enums.py b/app/content/enums.py
index 686bb2343..3f0ced1d3 100644
--- a/app/content/enums.py
+++ b/app/content/enums.py
@@ -1,5 +1,7 @@
from django.db import models
+from enumchoicefield import ChoiceEnum
+
class UserClass(models.IntegerChoices):
FIRST = 1
@@ -7,3 +9,12 @@ class UserClass(models.IntegerChoices):
THIRD = 3
FORTH = 4
FIFTH = 5
+
+
+class CategoryEnum(ChoiceEnum):
+ ACTIVITY = "Aktivitet"
+ SOSIALT = "Sosialt"
+ BEDPRES = "Bedpres"
+ KURS = "Kurs"
+ ANNET = "Annet"
+ FADDERUKA = "Fadderuka"
diff --git a/app/content/views/event.py b/app/content/views/event.py
index 632e2c855..334dd8b1f 100644
--- a/app/content/views/event.py
+++ b/app/content/views/event.py
@@ -19,8 +19,9 @@
)
from app.communication.notifier import Notify
from app.constants import MAIL_INDEX
+from app.content.enums import CategoryEnum
from app.content.filters import EventFilter
-from app.content.models import Event, User
+from app.content.models import Category, Event, User
from app.content.serializers import (
EventCreateAndUpdateSerializer,
EventListSerializer,
@@ -60,11 +61,33 @@ def _list_queryset(self):
or "start_range" in self.request.query_params
):
return self.queryset
+
+ activity = self.request.query_params.get("activity", "false").lower() == "true"
+ category = Category.objects.filter(text=CategoryEnum.ACTIVITY).first()
expired = self.request.query_params.get("expired", "false").lower() == "true"
+
+ if activity and category:
+ return self._list_activity_queryset(category, expired, time)
+
if expired:
return self.queryset.filter(end_date__lt=time).order_by("-start_date")
+
+ if category:
+ return self.queryset.filter(end_date__gte=time).filter(
+ ~Q(category=category)
+ )
+
return self.queryset.filter(end_date__gte=time)
+ def _list_activity_queryset(self, category, expired, time):
+ if expired:
+ return (
+ self.queryset.filter(end_date__lt=time)
+ .filter(category=category)
+ .order_by("-start_date")
+ )
+ return self.queryset.filter(end_date__gte=time).filter(category=category)
+
def get_serializer_class(self):
if hasattr(self, "action") and self.action == "list":
return EventListSerializer
diff --git a/app/fixture.json b/app/fixture.json
index 6e6753497..b38fc20e4 100644
--- a/app/fixture.json
+++ b/app/fixture.json
@@ -222,6 +222,14 @@
"expire_date": "2020-11-01T13:09:22.974Z"
}
},
+{
+ "model": "sessions.session",
+ "pk": "wd487o1l4lippc8nvmsu76awx1m5ql7r",
+ "fields": {
+ "session_data": ".eJxVjMsOgjAQRf-la9MMU1qKS_d8A5lHEdSUhEJiYvx3JWGh23vOuS_T07aO_VbS0k9qzmbKmp7m9LszyT3lHeqN8nW2Mud1mdjuij1osd2s6XE53L-Dkcr4rYGHWps01IQDsPMCFH1yEFgqCFBxCK1G9Si1i4JOBINvGCNS2yCBeX8AKt85bQ:1r12e9:uu-Il52WMklNtfTpwkcRT-L2Uyh_lHDZS1YG23T5YRE",
+ "expire_date": "2023-11-23T10:52:25.327Z"
+ }
+},
{
"model": "sessions.session",
"pk": "x2g88outp6fek547v1t7wdp2kqv00bpn",
@@ -380,6 +388,20 @@
"users": []
}
},
+{
+ "model": "communication.mail",
+ "pk": "50725749-a31c-4721-9d5e-019a7e5849ae",
+ "fields": {
+ "created_at": "2023-11-06T20:42:11.302Z",
+ "updated_at": "2023-11-06T20:42:11.302Z",
+ "eta": "2023-11-06T20:42:11.301Z",
+ "subject": "Du har fått en prikk",
+ "body": "\n\n
\n \n TIHLDE - Du har fått en prikk \n \n \n\n\n\n \n
\n \n \n \n \n \n | \n
\n \n
\n \n
\n \n\n
DU HAR FÅTT EN PRIKK
\n\n \n
Hei, Index!
\n \n\n \n
Du har fått prikk fordi du ikke møtte på et arrangement
\n \n\n \n
Prikken varer i 20 dager. Ta kontakt med arrangøren om du er uenig. Konsekvenser kan sees i arrangementsreglene. Du kan finne dine aktive prikker og mer info om dem i profilen.
\n \n\n\n\n\n
Med vennlig hilsen,
TIHLDE
\n
\n
\n
\n
Sendt med 💗 av TIHLDE Index
\n
Ønsker du å motta færre eposter? Du kan selv bestemme hvor du vil motta varsler gjennom innstillingene i din profil
\n
\n
\n\n\n\n",
+ "users": [
+ "index"
+ ]
+ }
+},
{
"model": "communication.mail",
"pk": "5438caae-5f15-4ce2-b042-85132ff72d54",
@@ -865,40 +887,71 @@
"read": false
}
},
+{
+ "model": "communication.notification",
+ "pk": 38,
+ "fields": {
+ "created_at": "2023-11-06T20:42:11.352Z",
+ "updated_at": "2023-11-06T20:43:18.008Z",
+ "user": "index",
+ "title": "Du har fått en prikk",
+ "description": "Hei, Index!\n\nDu har fått prikk fordi du ikke møtte på et arrangement\n\nPrikken varer i 20 dager. Ta kontakt med arrangøren om du er uenig. Konsekvenser kan sees i arrangementsreglene. Du kan finne dine aktive prikker og mer info om dem i profilen.",
+ "link": null,
+ "read": true
+ }
+},
{
"model": "content.category",
- "pk": 1,
+ "pk": 5,
"fields": {
- "created_at": "2020-10-01T18:29:57.037Z",
- "updated_at": "2020-10-01T18:29:57.037Z",
- "text": "Fest"
+ "created_at": "2020-10-01T18:32:18.564Z",
+ "updated_at": "2020-10-01T18:32:18.564Z",
+ "text": "Aktivitet"
}
},
{
"model": "content.category",
- "pk": 2,
+ "pk": 6,
"fields": {
- "created_at": "2020-10-01T18:30:12.523Z",
- "updated_at": "2020-10-01T18:30:12.523Z",
- "text": "Bedpress"
+ "created_at": "2023-11-09T10:53:06.747Z",
+ "updated_at": "2023-11-09T10:53:06.747Z",
+ "text": "Sosialt"
}
},
{
"model": "content.category",
- "pk": 3,
+ "pk": 7,
"fields": {
- "created_at": "2020-10-01T18:30:37.229Z",
- "updated_at": "2020-10-01T18:30:37.229Z",
- "text": "Fadderuke"
+ "created_at": "2023-11-09T10:53:12.069Z",
+ "updated_at": "2023-11-09T10:53:12.069Z",
+ "text": "Bedpres"
}
},
{
"model": "content.category",
- "pk": 4,
+ "pk": 8,
"fields": {
- "created_at": "2020-10-01T18:32:18.564Z",
- "updated_at": "2020-10-01T18:32:18.564Z",
- "text": "Sport"
+ "created_at": "2023-11-09T10:53:17.027Z",
+ "updated_at": "2023-11-09T10:53:17.027Z",
+ "text": "Fadderuka"
+ }
+},
+{
+ "model": "content.category",
+ "pk": 9,
+ "fields": {
+ "created_at": "2023-11-09T10:53:21.608Z",
+ "updated_at": "2023-11-09T10:53:21.608Z",
+ "text": "Annet"
+ }
+},
+{
+ "model": "content.category",
+ "pk": 10,
+ "fields": {
+ "created_at": "2023-11-09T10:53:26.390Z",
+ "updated_at": "2023-11-09T10:53:26.390Z",
+ "text": "Kurs"
}
},
{
@@ -925,7 +978,7 @@
"last_login": null,
"is_superuser": false,
"created_at": "2023-10-27T17:07:02.878Z",
- "updated_at": "2023-10-27T17:07:03.166Z",
+ "updated_at": "2023-11-09T10:55:32.102Z",
"image": null,
"image_alt": null,
"first_name": "HS",
@@ -937,7 +990,7 @@
"tool": "",
"slack_user_id": "",
"allows_photo_by_default": true,
- "accepts_event_rules": false,
+ "accepts_event_rules": true,
"is_staff": false,
"is_active": true,
"groups": [],
@@ -949,7 +1002,7 @@
"pk": "index",
"fields": {
"password": "pbkdf2_sha256$600000$zrpHc6MciDYg9OkGFSllUd$YksemKm752mxdPN2bdz8VEiItI1DSacPr0ik2jHHN4Q=",
- "last_login": "2023-10-24T14:40:34.061Z",
+ "last_login": "2023-11-09T10:52:25.310Z",
"is_superuser": true,
"created_at": "2020-10-01T18:22:57.665Z",
"updated_at": "2023-10-24T14:24:58.273Z",
@@ -981,7 +1034,7 @@
"last_login": null,
"is_superuser": false,
"created_at": "2023-10-27T17:16:16.246Z",
- "updated_at": "2023-10-27T17:16:16.481Z",
+ "updated_at": "2023-11-09T10:55:45.542Z",
"image": null,
"image_alt": null,
"first_name": "Medlem",
@@ -993,7 +1046,7 @@
"tool": "",
"slack_user_id": "",
"allows_photo_by_default": true,
- "accepts_event_rules": false,
+ "accepts_event_rules": true,
"is_staff": false,
"is_active": true,
"groups": [],
@@ -1008,7 +1061,7 @@
"last_login": null,
"is_superuser": false,
"created_at": "2023-10-27T17:05:44.981Z",
- "updated_at": "2023-10-27T17:05:45.240Z",
+ "updated_at": "2023-11-09T10:55:52.122Z",
"image": null,
"image_alt": null,
"first_name": "NoK",
@@ -1020,7 +1073,7 @@
"tool": "",
"slack_user_id": "",
"allows_photo_by_default": true,
- "accepts_event_rules": false,
+ "accepts_event_rules": true,
"is_staff": false,
"is_active": true,
"groups": [],
@@ -1035,7 +1088,7 @@
"last_login": null,
"is_superuser": false,
"created_at": "2023-10-27T17:06:16.718Z",
- "updated_at": "2023-10-27T17:06:16.965Z",
+ "updated_at": "2023-11-09T10:56:04.127Z",
"image": null,
"image_alt": null,
"first_name": "Promo",
@@ -1047,7 +1100,7 @@
"tool": "",
"slack_user_id": "",
"allows_photo_by_default": true,
- "accepts_event_rules": false,
+ "accepts_event_rules": true,
"is_staff": false,
"is_active": true,
"groups": [],
@@ -1062,7 +1115,7 @@
"last_login": null,
"is_superuser": false,
"created_at": "2023-10-27T17:06:42.315Z",
- "updated_at": "2023-10-27T17:06:42.552Z",
+ "updated_at": "2023-11-09T10:56:09.458Z",
"image": null,
"image_alt": null,
"first_name": "Sosialen",
@@ -1074,7 +1127,7 @@
"tool": "",
"slack_user_id": "",
"allows_photo_by_default": true,
- "accepts_event_rules": false,
+ "accepts_event_rules": true,
"is_staff": false,
"is_active": true,
"groups": [],
@@ -1094,7 +1147,7 @@
"end_date": "2029-07-05T12:00:00Z",
"location": "Kristiansand",
"description": "Palmesus er Skandinavias største strandfest. Hvert år samles nesten 40 000 festglade mennesker på Bystranda midt i Kristiansand sentrum for å nyte sol, sommer og en helt enestående fest. \n\nSelv om det er den gode stemningen og selve strandfesten som står i sentrum er det likevel alltid en svært sterk line-up på Palmesus. Artister som KYGO, Martin Garrix, Kent, Migos, Jason Derulo, Axwell ^ Ingrosso, Dimitri Vegas & Like Mike, Madcon, Taio Cruz, Benny Benassi, Nelly Furtado, Faithless, Fedde Le Grand, Karpe Diem, Fatboy Slim, Steve Aoki, Wyclef Jean, Charlie XCX, Highasakite og mange flere har alle spilt på Palmesus.",
- "category": 3,
+ "category": null,
"organizer": null,
"contact_person": null,
"can_cause_strikes": true,
@@ -1125,7 +1178,7 @@
"end_date": "2028-06-09T16:00:00Z",
"location": "Rockheim",
"description": "**Lær å lage native apps for alle plattformer - Flutter 101**\n\nFlutter er et open source UI toolkit laget av Google ene og alene for native compiled apps for mobile, web og desktop. Alt fra en kodebase! All utvikling skjer i programmeringsspråket Dart, som er designet for å lage raske apps til alle plattformer.\n\nI kurset vil vi ha en kort gjennomgang av Flutter og Dart, for så å bevege oss over til å lage en app. Learning by doing er beste måten å lære. Ved kursslutt sitter du med en fiks ferdig app! Du trenger ingen erfaring med apputvikling, Dart eller Flutter for å bli med.\n\nKurset vil hovedsakelig ta for seg utvikling til iOS og Android, så det man må få installert et par ting på forhånd. Dette er lurt å gjøre før kursstart, slik at vi slipper å bruke kurstid på installasjon. På lenkene under følger enkle steg for hvordan man kan få installert det man trenger.\n\nWindows: [https://flutter.dev/docs/get-started/install/windows](https://flutter.dev/docs/get-started/install/windows)\n\nMac: [https://flutter.dev/docs/get-started/install/macos](https://flutter.dev/docs/get-started/install/macos)\n\nLinux: [https://flutter.dev/docs/get-started/install/linux](https://flutter.dev/docs/get-started/install/linux)\n\nEditor setup: [https://flutter.dev/docs/get-started/editor](https://flutter.dev/docs/get-started/editor)\n\nKursleder vil bruke Android Studio, men du velger fritt om du heller vil bruke IntelliJ, VSCode eller Emacs. \n\nTa gjerne en titt her for å kjøre en enkel testrunde: [https://flutter.dev/docs/get-started/test-drive](https://flutter.dev/docs/get-started/test-drive)\n\n\nKodeworks sponser også gavekort fra Foodora, så man kan ta seg en matbit under kurset!",
- "category": 1,
+ "category": null,
"organizer": null,
"contact_person": null,
"can_cause_strikes": true,
@@ -1156,7 +1209,7 @@
"end_date": "2029-05-17T09:15:00Z",
"location": "Trondheim",
"description": "Bli med\n\n![ty](https://www.logiqpay.no/wp-content/uploads/2020/03/bouvet_nyhet.png)",
- "category": 1,
+ "category": null,
"organizer": null,
"contact_person": null,
"can_cause_strikes": true,
@@ -1187,7 +1240,7 @@
"end_date": "2030-04-23T12:00:00Z",
"location": "Her",
"description": "**Lær å lage native apps for alle plattformer - Flutter 101**\n\nFlutter er et open source UI toolkit laget av Google ene og alene for native compiled apps for mobile, web og desktop. Alt fra en kodebase! All utvikling skjer i programmeringsspråket Dart, som er designet for å lage raske apps til alle plattformer.\n\nI kurset vil vi ha en kort gjennomgang av Flutter og Dart, for så å bevege oss over til å lage en app. Learning by doing er beste måten å lære. Ved kursslutt sitter du med en fiks ferdig app! Du trenger ingen erfaring med apputvikling, Dart eller Flutter for å bli med.\n\nKurset vil hovedsakelig ta for seg utvikling til iOS og Android, så det man må få installert et par ting på forhånd. Dette er lurt å gjøre før kursstart, slik at vi slipper å bruke kurstid på installasjon. På lenkene under følger enkle steg for hvordan man kan få installert det man trenger.\n\nWindows: [https://flutter.dev/docs/get-started/install/windows](https://flutter.dev/docs/get-started/install/windows)\n\nMac: [https://flutter.dev/docs/get-started/install/macos](https://flutter.dev/docs/get-started/install/macos)\n\nLinux: [https://flutter.dev/docs/get-started/install/linux](https://flutter.dev/docs/get-started/install/linux)\n\nEditor setup: [https://flutter.dev/docs/get-started/editor](https://flutter.dev/docs/get-started/editor)\n\nKursleder vil bruke Android Studio, men du velger fritt om du heller vil bruke IntelliJ, VSCode eller Emacs. \n\nTa gjerne en titt her for å kjøre en enkel testrunde: [https://flutter.dev/docs/get-started/test-drive](https://flutter.dev/docs/get-started/test-drive)\n\n\nKodeworks sponser også gavekort fra Foodora, så man kan ta seg en matbit under kurset!",
- "category": 1,
+ "category": null,
"organizer": null,
"contact_person": null,
"can_cause_strikes": true,
@@ -1218,7 +1271,7 @@
"end_date": "2025-03-22T20:00:00Z",
"location": "Zoom",
"description": "Velkomment til bedpres med Telia!\r\n\r\nTelia er et ledende teknologiselskap som arbeider med å utvikle digitale plattformer og tjenester slik at selskaper kan ta del av de enorme mulighetene innen digital transformasjon. Med store kunder som AkerBP gjør vår teknologi det mulig å utnytte data for blant annet bedre beslutningstaking og innovasjon.\r\n\r\nGjennom bedriftspresentasjonen vil dere bli kjent med et knippe Teliaere, deres reise i selskapet og mulighetene som ligger til rette for studenter som dere. Det blir også gavekort på Wolt på 300kr slik at dere kan nyte noe godt underveis.\r\n\r\nVi gleder oss til å bli bedre kjent!",
- "category": 1,
+ "category": null,
"organizer": null,
"contact_person": null,
"can_cause_strikes": true,
@@ -1249,7 +1302,7 @@
"end_date": "2023-10-27T03:23:57Z",
"location": "Oslo",
"description": "Test",
- "category": 1,
+ "category": null,
"organizer": "index",
"contact_person": null,
"can_cause_strikes": true,
@@ -1261,12 +1314,136 @@
"end_registration_at": "2023-10-25T03:24:00Z",
"sign_off_deadline": "2023-10-23T10:00:00Z",
"only_allow_prioritized": false,
+ "runned_post_event_actions": true,
+ "runned_sign_off_deadline_reminder": true,
+ "runned_sign_up_start_notifier": true,
+ "favorite_users": []
+ }
+},
+{
+ "model": "content.event",
+ "pk": 10,
+ "fields": {
+ "created_at": "2023-11-06T20:52:59.325Z",
+ "updated_at": "2023-11-07T13:09:05.390Z",
+ "image": "",
+ "image_alt": "",
+ "title": "Aktivitet",
+ "start_date": "2023-11-16T04:23:42Z",
+ "end_date": "2023-11-16T06:23:42Z",
+ "location": "Test",
+ "description": "test",
+ "category": 5,
+ "organizer": "gloshaugen",
+ "contact_person": null,
+ "can_cause_strikes": true,
+ "enforces_previous_strikes": true,
+ "sign_up": false,
+ "limit": 0,
+ "closed": false,
+ "start_registration_at": "2023-11-09T11:00:00Z",
+ "end_registration_at": "2023-11-16T04:00:00Z",
+ "sign_off_deadline": "2023-11-15T11:00:00Z",
+ "only_allow_prioritized": false,
+ "runned_post_event_actions": false,
+ "runned_sign_off_deadline_reminder": false,
+ "runned_sign_up_start_notifier": false,
+ "favorite_users": []
+ }
+},
+{
+ "model": "content.event",
+ "pk": 11,
+ "fields": {
+ "created_at": "2023-11-06T21:10:12.573Z",
+ "updated_at": "2023-11-06T21:10:12.573Z",
+ "image": "",
+ "image_alt": "",
+ "title": "Test NOK",
+ "start_date": "2023-11-06T21:09:57.595Z",
+ "end_date": "2023-11-06T23:09:57.992Z",
+ "location": "test",
+ "description": "test",
+ "category": null,
+ "organizer": "nok",
+ "contact_person": null,
+ "can_cause_strikes": true,
+ "enforces_previous_strikes": true,
+ "sign_up": false,
+ "limit": 0,
+ "closed": false,
+ "start_registration_at": "2023-10-30T11:00:00Z",
+ "end_registration_at": "2023-11-06T11:00:00Z",
+ "sign_off_deadline": "2023-11-05T11:00:00Z",
+ "only_allow_prioritized": false,
+ "runned_post_event_actions": false,
+ "runned_sign_off_deadline_reminder": false,
+ "runned_sign_up_start_notifier": false,
+ "favorite_users": []
+ }
+},
+{
+ "model": "content.event",
+ "pk": 12,
+ "fields": {
+ "created_at": "2023-11-06T21:42:07.504Z",
+ "updated_at": "2023-11-06T21:42:07.504Z",
+ "image": "",
+ "image_alt": "",
+ "title": "Påmelding",
+ "start_date": "2023-11-09T15:21:47Z",
+ "end_date": "2023-11-09T17:21:47Z",
+ "location": "test",
+ "description": "1",
+ "category": 5,
+ "organizer": "nok",
+ "contact_person": null,
+ "can_cause_strikes": true,
+ "enforces_previous_strikes": true,
+ "sign_up": true,
+ "limit": 1,
+ "closed": false,
+ "start_registration_at": "2023-11-02T11:00:00Z",
+ "end_registration_at": "2023-11-09T11:00:00Z",
+ "sign_off_deadline": "2023-11-08T11:00:00Z",
+ "only_allow_prioritized": false,
"runned_post_event_actions": false,
"runned_sign_off_deadline_reminder": true,
"runned_sign_up_start_notifier": true,
"favorite_users": []
}
},
+{
+ "model": "content.event",
+ "pk": 13,
+ "fields": {
+ "created_at": "2023-11-06T21:42:26.621Z",
+ "updated_at": "2023-11-06T21:42:26.621Z",
+ "image": "",
+ "image_alt": "",
+ "title": "Ferdig",
+ "start_date": "2023-10-11T16:30:11Z",
+ "end_date": "2023-10-11T18:30:11Z",
+ "location": "Oslo",
+ "description": "test",
+ "category": 5,
+ "organizer": "nok",
+ "contact_person": null,
+ "can_cause_strikes": true,
+ "enforces_previous_strikes": true,
+ "sign_up": false,
+ "limit": 0,
+ "closed": false,
+ "start_registration_at": "2023-10-04T10:00:00Z",
+ "end_registration_at": "2023-10-11T10:00:00Z",
+ "sign_off_deadline": "2023-10-10T10:00:00Z",
+ "only_allow_prioritized": false,
+ "runned_post_event_actions": false,
+ "runned_sign_off_deadline_reminder": false,
+ "runned_sign_up_start_notifier": false,
+ "favorite_users": []
+ }
+},
{
"model": "content.news",
"pk": 1,
@@ -1323,6 +1500,19 @@
"body": "#### I år som i fjor kjører vi på med kåringer på julebordet!! \r\n\r\nHer kan du stemme frem årets frivillig, ildsjel, gledesspreder og mye mer. \r\n\r\nStem frem din favoritt! Kanskje er det akkurat den du stemmer på som får tildelt en av de gjeve titlene i år."
}
},
+{
+ "model": "content.strike",
+ "pk": "a296ae58-96bf-4fe8-8a5a-30a05eae7505",
+ "fields": {
+ "created_at": "2023-11-06T20:42:11.363Z",
+ "updated_at": "2023-11-06T20:42:11.363Z",
+ "description": "Du har fått prikk fordi du ikke møtte på et arrangement",
+ "strike_size": 2,
+ "user": "index",
+ "event": 9,
+ "creator": null
+ }
+},
{
"model": "content.registration",
"pk": 16,
@@ -1333,7 +1523,22 @@
"event": 3,
"is_on_wait": false,
"has_attended": false,
- "allow_photo": true
+ "allow_photo": true,
+ "created_by_admin": false
+ }
+},
+{
+ "model": "content.registration",
+ "pk": 17,
+ "fields": {
+ "created_at": "2023-10-24T14:25:05.091Z",
+ "updated_at": "2023-10-24T14:25:05.091Z",
+ "user": "index",
+ "event": 9,
+ "is_on_wait": false,
+ "has_attended": false,
+ "allow_photo": true,
+ "created_by_admin": false
}
},
{
diff --git a/app/group/admin.py b/app/group/admin.py
index 44eda2aa4..15c8c710c 100644
--- a/app/group/admin.py
+++ b/app/group/admin.py
@@ -24,10 +24,7 @@ class MembershipAdmin(admin.ModelAdmin):
"user",
)
- search_fields = [
- "user__first_name",
- "user__last_name"
- ]
+ search_fields = ["user__first_name", "user__last_name"]
@admin.register(models.MembershipHistory)
diff --git a/app/settings.py b/app/settings.py
index e603fec39..3998a2877 100644
--- a/app/settings.py
+++ b/app/settings.py
@@ -283,7 +283,9 @@
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
-CELERY_BROKER_URL = os.environ.get("CELERY_BROKER_URL") or "amqp://guest:guest@rabbitmq:5672"
+CELERY_BROKER_URL = (
+ os.environ.get("CELERY_BROKER_URL") or "amqp://guest:guest@rabbitmq:5672"
+)
if ENVIRONMENT == EnvironmentOptions.LOCAL:
CELERY_TASK_ALWAYS_EAGER = False
diff --git a/app/tests/content/test_event_integration.py b/app/tests/content/test_event_integration.py
index df255569f..a8b793f9c 100644
--- a/app/tests/content/test_event_integration.py
+++ b/app/tests/content/test_event_integration.py
@@ -7,7 +7,7 @@
from app.common.enums import AdminGroup, Groups, GroupType, MembershipType
from app.content.factories import EventFactory, RegistrationFactory, UserFactory
-from app.content.models import Event
+from app.content.models import Category, Event
from app.forms.enums import EventFormType
from app.forms.tests.form_factories import EventFormFactory
from app.group.factories import GroupFactory
@@ -170,10 +170,40 @@ def permission_test_util(
@pytest.mark.django_db
-def test_list_as_anonymous_user(default_client):
- """An anonymous user should be able to list all events."""
+def test_list_as_anonymous_user(default_client, event):
+ """An anonymous user should be able to list all events that are not activities."""
+
+ category = Category.objects.create(text="Aktivitet")
+ activity = EventFactory(category=category)
+
+ activity.category = category
+ activity.save()
+
+ event.category = None
+ event.save()
+
response = default_client.get(API_EVENTS_BASE_URL)
assert response.status_code == 200
+ assert response.json().get("count") == 1
+
+
+@pytest.mark.django_db
+def test_list_activities_as_anonymous_user(default_client, event):
+ """An anonymous user should be able to list all activities."""
+
+ category = Category.objects.create(text="Aktivitet")
+ activity = EventFactory(category=category)
+
+ activity.category = category
+ activity.save()
+
+ event.category = None
+ event.save()
+
+ response = default_client.get(f"{API_EVENTS_BASE_URL}?activity=true")
+
+ assert response.status_code == 200
+ assert response.json().get("count") == 1
@pytest.mark.django_db