Coverage for website/thaliawebsite/apps.py: 100.00%

11 statements  

« prev     ^ index     » next       coverage.py v7.6.7, created at 2025-08-14 10:31 +0000

1from django.apps import AppConfig 

2from django.contrib.admin.apps import AdminConfig 

3from django.urls import reverse 

4 

5 

6class ThaliaWebsiteConfig(AppConfig): 

7 name = "thaliawebsite" 

8 

9 def menu_items(self): 

10 return {"items": [{"title": "Home", "url": reverse("index"), "key": 0}]} 

11 

12 def user_menu_items(self): 

13 return { 

14 "sections": [{"name": "general", "key": 3}, {"name": "profile", "key": 1}], 

15 "items": [ 

16 { 

17 "section": "general", 

18 "title": "Site administration", 

19 "url": reverse("admin:index"), 

20 "show": lambda request: request.user.is_staff, 

21 "key": 0, 

22 }, 

23 { 

24 "section": "general", 

25 "title": "Log out", 

26 "url": reverse("logout"), 

27 "key": 1, 

28 }, 

29 { 

30 "section": "profile", 

31 "title": "Authorised applications", 

32 "url": reverse("oauth2_provider:authorized-token-list"), 

33 "key": 3, 

34 }, 

35 { 

36 "section": "profile", 

37 "title": "Change password", 

38 "url": reverse("password_change"), 

39 "key": 4, 

40 }, 

41 { 

42 "section": "profile", 

43 "title": "Manage 2FA", 

44 "url": reverse("two_factor:profile"), 

45 "key": 5, 

46 }, 

47 ], 

48 } 

49 

50 

51class ThaliaAdminConfig(AdminConfig): 

52 default_site = "thaliawebsite.admin.ThaliaAdminSite"