Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1# (c) 2018-2020 

2# MPIB <https://www.mpib-berlin.mpg.de/>, 

3# MPI-CBS <https://www.cbs.mpg.de/>, 

4# MPIP <http://www.psych.mpg.de/> 

5# 

6# This file is part of Castellum. 

7# 

8# Castellum is free software; you can redistribute it and/or modify it 

9# under the terms of the GNU Affero General Public License as published 

10# by the Free Software Foundation; either version 3 of the License, or 

11# (at your option) any later version. 

12# 

13# Castellum is distributed in the hope that it will be useful, but 

14# WITHOUT ANY WARRANTY; without even the implied warranty of 

15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 

16# Affero General Public License for more details. 

17# 

18# You should have received a copy of the GNU Affero General Public 

19# License along with Castellum. If not, see 

20# <http://www.gnu.org/licenses/>. 

21 

22from django.conf import settings 

23from django.contrib import admin 

24from django.contrib.auth.mixins import LoginRequiredMixin 

25from django.contrib.auth.views import LoginView 

26from django.contrib.auth.views import LogoutView 

27from django.http import HttpResponse 

28from django.urls import include 

29from django.urls import path 

30from django.views.generic import RedirectView 

31from django.views.generic import TemplateView 

32from django.views.i18n import JavaScriptCatalog 

33from django.views.static import serve 

34 

35from stronghold.decorators import public 

36 

37from castellum.castellum_auth.forms import AuthenticationForm 

38from castellum.castellum_auth.views import set_language 

39 

40 

41class IndexView(LoginRequiredMixin, TemplateView): 

42 template_name = 'index.html' 

43 

44 

45def dummy(request): 

46 return HttpResponse('', status=204) 

47 

48 

49urlpatterns = [ 

50 path('', IndexView.as_view(), name='index'), 

51 path('login/', LoginView.as_view( 

52 template_name="login.html", 

53 authentication_form=AuthenticationForm, 

54 ), name='login'), 

55 path('logout/', LogoutView.as_view(), name='logout'), 

56 path('favicon.ico', public(RedirectView.as_view(url='/static/images/favicon.ico'))), 

57 path('ping/', dummy, name='ping'), 

58 

59 path('i18n/', set_language, name='set_language'), 

60 path('jsi18n/', JavaScriptCatalog.as_view(), name='javascript-catalog'), 

61 

62 path('admin/', admin.site.urls), 

63 path('recruitment/', include('castellum.recruitment.urls', namespace='recruitment')), 

64 path('execution/', include('castellum.execution.urls', namespace='execution')), 

65 path('studies/', include('castellum.studies.urls', namespace='studies')), 

66 path('subjects/', include('castellum.subjects.urls', namespace='subjects')), 

67 path( 

68 'data-protection/', include('castellum.data_protection.urls', namespace='data_protection') 

69 ), 

70] 

71 

72if settings.DEBUG: 72 ↛ 73line 72 didn't jump to line 73, because the condition on line 72 was never true

73 urlpatterns += [ 

74 path('media/<path:path>', serve, {'document_root': settings.MEDIA_ROOT}), 

75 ] 

76 

77try: 

78 import debug_toolbar 

79 urlpatterns += [ 

80 path('__debug__/', include(debug_toolbar.urls)), 

81 ] 

82except ImportError: 

83 pass