diff --git a/src/feedback/tests/__init__.py b/src/feedback/tests/__init__.py index b345d4a..a333674 100644 --- a/src/feedback/tests/__init__.py +++ b/src/feedback/tests/__init__.py @@ -1,5 +1,7 @@ # coding=utf-8 +from django.utils.translation import get_language + #TODO: Aufruf einzelner Tests möglich machen def suite(): @@ -23,8 +25,8 @@ def suite(): suite.addTest(unittest.TestLoader().loadTestsFromName(test_module)) return suite -LOGIN_END = '/intern/' -INDEX_END = '/intern/uebersicht/' +LOGIN_END = f'/{get_language()}/intern/' +INDEX_END = f'/{get_language()}/intern/uebersicht/' TESTSERVER_BEGIN = '' LOGIN_URL = TESTSERVER_BEGIN+LOGIN_END INDEX_URL = TESTSERVER_BEGIN+INDEX_END diff --git a/src/feedback/tests/redirect_urls.py b/src/feedback/tests/redirect_urls.py index c529811..ac6ee49 100644 --- a/src/feedback/tests/redirect_urls.py +++ b/src/feedback/tests/redirect_urls.py @@ -2,10 +2,12 @@ from django.urls import re_path from feedback.views import redirect +from django.conf.urls.i18n import i18n_patterns -urlpatterns = [ + +urlpatterns = i18n_patterns( re_path(r'^redirect/$', redirect, {'redirect_to': 'http://www.d120.de/'}), re_path(r'^redirect/(?P.*)$', redirect, {'redirect_to': 'http://www.d120.de/'}), -] +) diff --git a/src/feedback/tests/test_latex.py b/src/feedback/tests/test_latex.py index b600faa..51b3aea 100644 --- a/src/feedback/tests/test_latex.py +++ b/src/feedback/tests/test_latex.py @@ -6,6 +6,7 @@ from feedback.models import Semester, Person, Veranstaltung, Fragebogen2009, Mailvorlage from feedback.tests.tools import NonSuTestMixin, get_veranstaltung +from django.utils.translation import get_language @tag('latex') class GenerateLettersTest(NonSuTestMixin, TestCase): @@ -29,7 +30,7 @@ def setUp(self): except OSError: return self.skipTest("OSError while looking for pdflatex") - self.path = '/intern/generate_letters/' + self.path = f'/{get_language()}/intern/generate_letters/' try: self.orig_contents = self._get_erhebungswoche() except IOError: diff --git a/src/feedback/tests/test_models.py b/src/feedback/tests/test_models.py index 50eacae..768b414 100644 --- a/src/feedback/tests/test_models.py +++ b/src/feedback/tests/test_models.py @@ -17,6 +17,7 @@ from feedback.tests.tools import get_veranstaltung from django.urls import reverse from django.contrib.auth.models import User +from django.utils.translation import get_language class InitTest(TestCase): @@ -501,7 +502,7 @@ def test_veranstalter_url(self): self.assertEqual(len(url_parts), 2) ver_id = self.v[0].id self.assertEqual(url_parts[0], - 'https://www.fachschaft.informatik.tu-darmstadt.de/veranstalter/login/?vid=%d' % ver_id) + f'https://www.fachschaft.informatik.tu-darmstadt.de/{get_language()}/veranstalter/login/?vid={ver_id}') access_token = self.v[0].access_token self.assertEqual('token=' + access_token, url_parts[1]) # FIXME: Is the below assert necessary? Since Python3 strings are all Unicode diff --git a/src/feedback/tests/test_views_intern.py b/src/feedback/tests/test_views_intern.py index bfbb8ac..200156b 100644 --- a/src/feedback/tests/test_views_intern.py +++ b/src/feedback/tests/test_views_intern.py @@ -14,6 +14,7 @@ from feedback.models import Semester, Person, Veranstaltung, Fragebogen2009, Mailvorlage, \ Fachgebiet, FachgebietEmail, Tutor, EmailEndung from feedback.tests.tools import NonSuTestMixin, get_veranstaltung +from django.utils.translation import get_language from feedback import tests @@ -24,7 +25,7 @@ def setUp(self): self.s, self.v = get_veranstaltung('vu') def test_close_order_bestellung_liegt_vor_post(self): - path = '/intern/status_final/' + path = f'/{get_language()}/intern/status_final/' self.v.status = Veranstaltung.STATUS_BESTELLUNG_LIEGT_VOR self.v.save() @@ -35,7 +36,7 @@ def test_close_order_bestellung_liegt_vor_post(self): self.assertEqual(self.v.status, Veranstaltung.STATUS_BESTELLUNG_WIRD_VERARBEITET) def test_close_order_keine_evaluation_post(self): - path = '/intern/status_final/' + path = f'/{get_language()}/intern/status_final/' self.v.status = Veranstaltung.STATUS_KEINE_EVALUATION self.v.save() @@ -46,7 +47,7 @@ def test_close_order_keine_evaluation_post(self): self.assertEqual(self.v.status, Veranstaltung.STATUS_KEINE_EVALUATION_FINAL) def test_close_order_status_angelegt_post(self): - path = '/intern/status_final/' + path = f'/{get_language()}/intern/status_final/' self.v.status = Veranstaltung.STATUS_ANGELEGT self.v.save() @@ -57,7 +58,7 @@ def test_close_order_status_angelegt_post(self): self.assertEqual(self.v.status, Veranstaltung.STATUS_KEINE_EVALUATION_FINAL) def test_close_order_bestellung_geoeffnet_post(self): - path = '/intern/status_final/' + path = f'/{get_language()}/intern/status_final/' self.v.status = Veranstaltung.STATUS_BESTELLUNG_GEOEFFNET self.v.save() @@ -68,7 +69,7 @@ def test_close_order_bestellung_geoeffnet_post(self): self.assertEqual(self.v.status, Veranstaltung.STATUS_KEINE_EVALUATION_FINAL) def test_close_order_refuse(self): - path = '/intern/status_final/' + path = f'/{get_language()}/intern/status_final/' self.v.status = Veranstaltung.STATUS_BESTELLUNG_LIEGT_VOR self.v.save() @@ -92,7 +93,7 @@ def test_index(self): self.assertEqual(response.context['cur_semester'], s) def test_fragebogensprache(self): - path = '/intern/fragebogensprache/' + path = f'/{get_language()}/intern/fragebogensprache/' self.do_non_su_test(path) self.client.login(username='supers', password='pw') @@ -102,7 +103,7 @@ def test_fragebogensprache(self): self.assertEqual(response.templates[0].name, 'intern/fragebogensprache.html') def test_export_veranstaltungen_get(self): - path = '/intern/export_veranstaltungen/' + path = f'/{get_language()}/intern/export_veranstaltungen/' self.do_non_su_test(path) self.client.login(username='supers', password='pw') @@ -118,7 +119,7 @@ def checkXMLEqual(self, xml1, xml2): self.assertEqual(xml1, xml2) def test_export_veranstaltungen_post(self): - path = '/intern/export_veranstaltungen/' + path = f'/{get_language()}/intern/export_veranstaltungen/' self.client.login(username='supers', password='pw') self.client.login(username='supers', password='pw') @@ -343,7 +344,7 @@ def test_export_veranstaltungen_post(self): def test_export_veranstaltungen_post_primaerdozent(self): - path = '/intern/export_veranstaltungen/' + path = f'/{get_language()}/intern/export_veranstaltungen/' self.client.login(username='supers', password='pw') s, v = get_veranstaltung('v') @@ -441,7 +442,7 @@ def test_export_veranstaltungen_post_primaerdozent(self): class ImportErgebnisseTest(NonSuTestMixin, TestCase): def setUp(self): super(ImportErgebnisseTest, self).setUp() - self.path = '/intern/import_ergebnisse/' + self.path = f'/{get_language()}/intern/import_ergebnisse/' self.s = Semester.objects.create(semester=20110, fragebogen='2009', sichtbarkeit='ADM') def test_get(self): @@ -485,7 +486,7 @@ def test_post(self): class SyncErgebnisseTest(NonSuTestMixin, TestCase): def setUp(self): super(SyncErgebnisseTest, self).setUp() - self.path = '/intern/sync_ergebnisse/' + self.path = f'/{get_language()}/intern/sync_ergebnisse/' self.s, self.v = get_veranstaltung('v') def test_get(self): @@ -520,7 +521,7 @@ def test_post(self): class SendmailTest(NonSuTestMixin, TestCase): - path = '/intern/sendmail/' + path = f'/{get_language()}/intern/sendmail/' def test_get(self): self.do_non_su_test(self.path) diff --git a/src/feedback/tests/test_views_intern_auth.py b/src/feedback/tests/test_views_intern_auth.py index 47ead4e..d923487 100644 --- a/src/feedback/tests/test_views_intern_auth.py +++ b/src/feedback/tests/test_views_intern_auth.py @@ -8,6 +8,7 @@ from feedback.tests.tools import NonSuTestMixin, get_veranstaltung from feedback import tests from feedback.models import Veranstaltung +from django.utils.translation import get_language class InternAuthTest(NonSuTestMixin, TestCase): @@ -33,7 +34,7 @@ def test_login_debug_auth(self): self.assertEqual(response['Location'], tests.INDEX_URL) def test_rechte_uebernehmen(self): - path = '/intern/rechte_uebernehmen/' + path = f'/{get_language()}/intern/rechte_uebernehmen/' self.do_non_su_test(path) self.assertTrue(self.client.login(username='supers', password='pw')) @@ -52,15 +53,15 @@ def test_rechte_uebernehmen(self): def test_rechte_zuruecknehmen(self): self.client.login(username='supers', password='pw') - self.client.post('/intern/rechte_uebernehmen/', {'vid': self.v.id}, **{'REMOTE_USER': 'super'}) + self.client.post(f'/{get_language()}/intern/rechte_uebernehmen/', {'vid': self.v.id}, **{'REMOTE_USER': 'super'}) - response = self.client.get('/intern/rechte_zuruecknehmen/', **{'REMOTE_USER': 'super'}) + response = self.client.get(f'/{get_language()}/intern/rechte_zuruecknehmen/', **{'REMOTE_USER': 'super'}) self.assertEqual(response.status_code, 302) self.assertEqual(response['Location'], tests.INDEX_URL) def test_rechte_zuruecknehmen_no_origin_uid(self): """Es sollen rechte wiederhergestellt werden die vorher nicht abgegebn wurden""" self.assertTrue(self.client.login(username='supers', password='pw')) - response = self.client.get('/intern/rechte_zuruecknehmen/', **{'REMOTE_USER': 'super'}) + response = self.client.get(f'/{get_language()}/intern/rechte_zuruecknehmen/', **{'REMOTE_USER': 'super'}) self.assertEqual(response.status_code, 302) self.assertTrue(response['Location'].split('?')[0].endswith(tests.INDEX_END)) diff --git a/src/feedback/tests/test_views_intern_vv.py b/src/feedback/tests/test_views_intern_vv.py index 60b426c..5d0faf0 100644 --- a/src/feedback/tests/test_views_intern_vv.py +++ b/src/feedback/tests/test_views_intern_vv.py @@ -8,13 +8,14 @@ from feedback.forms import UploadFileForm from feedback.models import Semester, ImportCategory, ImportVeranstaltung, ImportPerson, Person from feedback.tests.tools import NonSuTestMixin, get_veranstaltung +from django.utils.translation import get_language from feedback import tests class InternVvTest(NonSuTestMixin): def test_import_vv(self): - path = '/intern/import_vv/' + path = f'/{get_language()}/intern/import_vv/' self.do_non_su_test(path) self.assertTrue(self.client.login(username='supers', password='pw')) @@ -32,7 +33,7 @@ def test_import_vv(self): self.assertTrue(response['Location'].endswith('/intern/import_vv_edit/')) def test_import_vv_edit_get(self): - path = '/intern/import_vv_edit/' + path = f'/{get_language()}/intern/import_vv_edit/' self.do_non_su_test(path) self.client.login(username='supers', password='pw') @@ -57,7 +58,7 @@ def test_import_vv_edit_post(self): iv1_sub = ImportVeranstaltung.objects.create(typ='vu', name='Bla II', category=ic_sub) self.client.login(username='supers', password='pw') - path = '/intern/import_vv_edit/' + path = f'/{get_language()}/intern/import_vv_edit/' # kein Semester angegeben response = self.client.post(path, {'v': [iv0.id, iv1.id, iv1_sub.id]}, **{'REMOTE_USER': 'super'}) @@ -79,7 +80,7 @@ def test_import_vv_edit_post(self): class InternVvEditUsersTest(NonSuTestMixin, TestCase): def setUp(self): super(InternVvEditUsersTest, self).setUp() - self.path = '/intern/import_vv_edit_users/' + self.path = f'/{get_language()}/intern/import_vv_edit_users/' self.p0 = Person.objects.create(vorname='Je', nachname='Mand') self.p1 = Person.objects.create(vorname='Auch Je', nachname='Mand') diff --git a/src/feedback/tests/test_views_public.py b/src/feedback/tests/test_views_public.py index 325fb87..1b50d77 100644 --- a/src/feedback/tests/test_views_public.py +++ b/src/feedback/tests/test_views_public.py @@ -12,17 +12,18 @@ import json from freezegun import freeze_time import datetime +from django.utils.translation import get_language @override_settings(ROOT_URLCONF=redirect_urls) class RedirectTest(TestCase): def test_redirect(self): - response = self.client.get('/redirect/') + response = self.client.get(f'/{get_language()}/redirect/') self.assertEqual(response.status_code, 301) self.assertEqual(response['Location'], 'http://www.d120.de/') - response = self.client.get('/redirect/fachschaft/') + response = self.client.get(f'/{get_language()}/redirect/fachschaft/') self.assertEqual(response.status_code, 301) self.assertEqual(response['Location'], 'http://www.d120.de/fachschaft/') @@ -44,25 +45,25 @@ def setUp(self): def test_unauth(self): # von außerhalb des Uninetzes - response = self.client.get('/ergebnisse/') + response = self.client.get(f'/{get_language()}/ergebnisse/') self.assertEqual(response.templates[0].name, 'public/unauth.html') def test_normal(self): # aus dem Uninetz ohne sichtbare Veranstaltungen (s1 nur für Admins) extra = {'REMOTE_ADDR': '130.83.0.1'} - response = self.client.get('/ergebnisse/', **extra) + response = self.client.get(f'/{get_language()}/ergebnisse/', **extra) self.assertEqual(response.templates[0].name, 'public/keine_ergebnisse.html') # aus dem Uninetz ohne sichtbare Veranstaltungen (s1 nur für Admins und Veranstalter) self.s1.sichtbarkeit = 'VER' self.s1.save() - response = self.client.get('/ergebnisse/', **extra) + response = self.client.get(f'/{get_language()}/ergebnisse/', **extra) self.assertEqual(response.templates[0].name, 'public/keine_ergebnisse.html') # aus dem Uninetz, s1 ist sichtbar self.s1.sichtbarkeit = 'ALL' self.s1.save() - response = self.client.get('/ergebnisse/', **extra) + response = self.client.get(f'/{get_language()}/ergebnisse/', **extra) self.assertEqual(response.templates[0].name, 'public/index.html') self.assertEqual(response.context['semester'], self.s1) self.assertSequenceEqual(response.context['semester_list'], [self.s1]) @@ -70,7 +71,7 @@ def test_normal(self): # aus dem Uninetz, s1 und s2 sind sichtbar self.s0.sichtbarkeit = 'ALL' self.s0.save() - response = self.client.get('/ergebnisse/', **extra) + response = self.client.get(f'/{get_language()}/ergebnisse/', **extra) self.assertEqual(response.templates[0].name, 'public/index.html') ctx = response.context self.assertEqual(ctx['semester'], self.s1) @@ -84,7 +85,7 @@ def test_normal(self): self.assertEqual(ctx['include_hidden'], False) # GET-Parameter: nur semester (Semesterauswahl) - response = self.client.get('/ergebnisse/', {'semester': self.s0.semester}, **extra) + response = self.client.get(f'/{get_language()}/ergebnisse/', {'semester': self.s0.semester}, **extra) self.assertEqual(response.templates[0].name, 'public/index.html') ctx = response.context self.assertEqual(ctx['semester'], self.s0) @@ -95,7 +96,7 @@ def test_normal(self): self.assertSequenceEqual(ctx['parts'], Ergebnis2009.parts) # GET-Parameter: nur order - response = self.client.get('/ergebnisse/', {'order': 'v_gesamt'}, **extra) + response = self.client.get(f'/{get_language()}/ergebnisse/', {'order': 'v_gesamt'}, **extra) self.assertEqual(response.templates[0].name, 'public/index.html') ctx = response.context self.assertEqual(ctx['semester'], self.s1) @@ -106,7 +107,7 @@ def test_normal(self): self.assertSequenceEqual(ctx['parts'], Ergebnis2009.parts) # GET-Parameter: nur order (ungültig) - response = self.client.get('/ergebnisse/', {'order': 'gibts_nicht'}, **extra) + response = self.client.get(f'/{get_language()}/ergebnisse/', {'order': 'gibts_nicht'}, **extra) self.assertEqual(response.templates[0].name, 'public/index.html') ctx = response.context self.assertEqual(ctx['order'], 'alpha') @@ -118,7 +119,7 @@ def test_normal(self): self.v0.save() self.v1.semester = self.s0 self.v1.save() - response = self.client.get('/ergebnisse/', {'semester': self.s0.semester, 'order': 'v_didaktik'}, + response = self.client.get(f'/{get_language()}/ergebnisse/', {'semester': self.s0.semester, 'order': 'v_didaktik'}, **extra) self.assertEqual(response.templates[0].name, 'public/index.html') ctx = response.context @@ -131,7 +132,7 @@ def test_normal(self): def test_superuser(self): self.client.login(username='testuser', password='secretpw') - response = self.client.get('/intern/ergebnisse/') + response = self.client.get(f'/{get_language()}/intern/ergebnisse/') self.assertEqual(response.templates[0].name, 'public/index.html') ctx = response.context self.assertEqual(ctx['semester'], self.s1) @@ -155,18 +156,18 @@ def setUp(self): def test_unauth(self): # von außerhalb des Uninetzes - response = self.client.get('/ergebnisse/%d/' % self.v.id) + response = self.client.get(f'/{get_language()}/ergebnisse/{self.v.id}/') self.assertEqual(response.templates[0].name, 'public/unauth.html') def test_nonexisting(self): extra = {'REMOTE_ADDR': '130.83.0.1'} - response = self.client.get('/ergebnisse/1337/', **extra) + response = self.client.get(f'/{get_language()}/ergebnisse/1337/', **extra) self.assertEqual(response.status_code, 404) self.assertEqual(response.templates[0].name, '404.html') def test_unsichtbar_adm(self): extra = {'REMOTE_ADDR': '130.83.0.1'} - response = self.client.get('/ergebnisse/%d/' % self.v.id, **extra) + response = self.client.get(f'/{get_language()}/ergebnisse/{self.v.id}/', **extra) self.assertEqual(response.status_code, 404) self.assertEqual(response.templates[0].name, '404.html') @@ -174,7 +175,7 @@ def test_unsichtbar_ver(self): self.s.sichtbarkeit = 'VER' self.s.save() extra = {'REMOTE_ADDR': '130.83.0.1'} - response = self.client.get('/ergebnisse/%d/' % self.v.id, **extra) + response = self.client.get(f'/{get_language()}/ergebnisse/{self.v.id}/', **extra) self.assertEqual(response.status_code, 404) self.assertEqual(response.templates[0].name, '404.html') @@ -182,7 +183,7 @@ def test_vu(self): self.s.sichtbarkeit = 'ALL' self.s.save() extra = {'REMOTE_ADDR': '130.83.0.1'} - response = self.client.get('/ergebnisse/%d/' % self.v.id, **extra) + response = self.client.get(f'/{get_language()}/ergebnisse/{self.v.id}/', **extra) ctx = response.context self.assertEqual(ctx['v'], self.v) with self.assertRaises(KeyError): @@ -198,7 +199,7 @@ def test_v(self): self.v.typ = 'v' self.v.save() extra = {'REMOTE_ADDR': '130.83.0.1'} - response = self.client.get('/ergebnisse/%d/' % self.v.id, **extra) + response = self.client.get(f'/{get_language()}/ergebnisse/{self.v.id}/', **extra) ctx = response.context self.assertEqual(ctx['v'], self.v) self.assertEqual(ctx['parts'], list(zip(Ergebnis2009.parts_vl, list(self.e.values())))) @@ -210,13 +211,13 @@ def test_kommentar(self): p = Person.objects.create() k = Kommentar.objects.create(veranstaltung=self.v, autor=p, text='Ganz ganz toll!') extra = {'REMOTE_ADDR': '130.83.0.1'} - response = self.client.get('/ergebnisse/%d/' % self.v.id, **extra) + response = self.client.get(f'/{get_language()}/ergebnisse/{self.v.id}/', **extra) ctx = response.context self.assertEqual(ctx['kommentar'], k) def test_veranstalter_adm(self): c = login_veranstalter(self.v) - response = c.get('/ergebnisse/%d/' % self.v.id) + response = c.get(f'/{get_language()}/ergebnisse/{self.v.id}/') self.assertEqual(response.status_code, 404) self.assertEqual(response.templates[0].name, '404.html') @@ -224,20 +225,20 @@ def test_veranstalter_ver(self): self.s.sichtbarkeit = 'VER' self.s.save() c = login_veranstalter(self.v) - response = c.get('/ergebnisse/%d/' % self.v.id) + response = c.get(f'/{get_language()}/ergebnisse/{self.v.id}/') ctx = response.context self.assertEqual(ctx['restricted'], True) def test_superuser(self): self.client.login(username='testuser', password='secretpw') - response = self.client.get('/ergebnisse/%d/' % self.v.id, **{'REMOTE_USER':'testuser'}) + response = self.client.get(f'/{get_language()}/ergebnisse/{self.v.id}/', **{'REMOTE_USER':'testuser'}) ctx = response.context self.assertEqual(ctx['restricted'], True) class PublicDropBarcode(TestCase): def setUp(self): - self.path = "/barcodedrop/" + self.path = f"/{get_language()}/barcodedrop/" self.barcode_scanner_no_access_right = BarcodeScanner.objects.create(token="LRh73Ds22", description="") self.barcode_scanner = BarcodeScanner.objects.create(token="LRh73Ds23", description="") diff --git a/src/feedback/tests/test_views_veranstalter.py b/src/feedback/tests/test_views_veranstalter.py index 22ae81d..2903925 100644 --- a/src/feedback/tests/test_views_veranstalter.py +++ b/src/feedback/tests/test_views_veranstalter.py @@ -6,6 +6,7 @@ from feedback.models import Person, Veranstaltung, Tutor from feedback.tests.tools import get_veranstaltung, login_veranstalter +from django.utils.translation import get_language class VeranstalterLoginTest(TestCase): def setUp(self): @@ -13,24 +14,24 @@ def setUp(self): User.objects.create_user(settings.USERNAME_VERANSTALTER) def test_incomplete_params(self): - response = self.client.get('/veranstalter/login/') + response = self.client.get(f'/{get_language()}/veranstalter/login/') self.assertEqual(response.templates[0].name, 'veranstalter/login_failed.html') - response = self.client.get('/veranstalter/login/', {'vid': self.v.id}) + response = self.client.get(f'/{get_language()}/veranstalter/login/', {'vid': self.v.id}) self.assertEqual(response.templates[0].name, 'veranstalter/login_failed.html') - response = self.client.get('/veranstalter/login/', {'token': self.v.access_token}) + response = self.client.get(f'/{get_language()}/veranstalter/login/', {'token': self.v.access_token}) self.assertEqual(response.templates[0].name, 'veranstalter/login_failed.html') def test_bad_params(self): - response = self.client.get('/veranstalter/login/', {'vid': self.v.id, 'token': 'inkorrekt'}) + response = self.client.get(f'/{get_language()}/veranstalter/login/', {'vid': self.v.id, 'token': 'inkorrekt'}) self.assertEqual(response.templates[0].name, 'veranstalter/login_failed.html') - response = self.client.get('/veranstalter/login/', {'vid': 123, 'token': self.v.access_token}) + response = self.client.get(f'/{get_language()}/veranstalter/login/', {'vid': 123, 'token': self.v.access_token}) self.assertEqual(response.templates[0].name, 'veranstalter/login_failed.html') def test_ok(self): - response = self.client.get('/veranstalter/login/', {'vid': self.v.id, + response = self.client.get(f'/{get_language()}/veranstalter/login/', {'vid': self.v.id, 'token': self.v.access_token}) self.assertEqual(response.status_code, 302) @@ -57,19 +58,19 @@ def setUp(self): self.v_wo_excercises.veranstalter.add(self.p3) def test_unauth(self): - response = self.client.get('/veranstalter/') + response = self.client.get(f'/{get_language()}/veranstalter/') self.assertEqual(response.templates[0].name, 'veranstalter/not_authenticated.html') def test_invalid_state(self): c = login_veranstalter(self.v) self.v.status = Veranstaltung.STATUS_GEDRUCKT self.v.save() - response = c.get('/veranstalter/bestellung') + response = c.get(f'/{get_language()}/veranstalter/bestellung') self.assertEqual(302, response.status_code) def test_nothing(self): c = login_veranstalter(self.v) - response = c.get('/veranstalter/') + response = c.get(f'/{get_language()}/veranstalter/') ctx = response.context self.assertEqual(ctx['veranstaltung'], self.v) with self.assertRaises(KeyError): @@ -79,12 +80,12 @@ def test_nothing(self): def test_post_bestellung(self): c = login_veranstalter(self.v) - response_first_step = c.post('/veranstalter/bestellung', {'evaluation-evaluieren': True, + response_first_step = c.post(f'/{get_language()}/veranstalter/bestellung', {'evaluation-evaluieren': True, "veranstalter_wizard-current_step": "evaluation"}) self.assertTemplateUsed(response_first_step, "formtools/wizard/basisdaten.html") - response_second_temp_step = c.post('/veranstalter/bestellung', { + response_second_temp_step = c.post(f'/{get_language()}/veranstalter/bestellung', { "veranstalter_wizard-current_step": "basisdaten", "basisdaten-typ": "vu", "basisdaten-anzahl": 22, @@ -98,7 +99,7 @@ def test_post_bestellung(self): self.assertTemplateUsed(response_second_temp_step, "formtools/wizard/digitale_evaluation.html") - response_second_step = c.post('/veranstalter/bestellung', { + response_second_step = c.post(f'/{get_language()}/veranstalter/bestellung', { "veranstalter_wizard-current_step": "digitale_eval", "digitale_eval-digitale_eval_type": "T", }) @@ -109,7 +110,7 @@ def test_post_bestellung(self): self.assertTemplateUsed(response_second_step, "formtools/wizard/freiefragen.html") - response_fifth_step = c.post('/veranstalter/bestellung', { + response_fifth_step = c.post(f'/{get_language()}/veranstalter/bestellung', { "veranstalter_wizard-current_step": "freie_fragen", "freie_fragen-freifrage1": "Ist das die erste Frage?", "freie_fragen-freifrage2": "Ist das die zweite Frage?" @@ -121,12 +122,12 @@ def test_post_bestellung(self): self.assertTemplateUsed(response_fifth_step, "formtools/wizard/veroeffentlichen.html") - response_seventh_step = c.post('/veranstalter/bestellung', {'veroeffentlichen-veroeffentlichen': True, + response_seventh_step = c.post(f'/{get_language()}/veranstalter/bestellung', {'veroeffentlichen-veroeffentlichen': True, "veranstalter_wizard-current_step": "veroeffentlichen"}) self.assertTemplateUsed(response_seventh_step, "formtools/wizard/zusammenfassung.html") - response_eight_step = c.post('/veranstalter/bestellung', { + response_eight_step = c.post(f'/{get_language()}/veranstalter/bestellung', { "veranstalter_wizard-current_step": "zusammenfassung" }) @@ -146,16 +147,16 @@ def test_post_bestellung(self): def test_missing_sessionid(self): c = login_veranstalter(self.v) del c.cookies[settings.SESSION_COOKIE_NAME] - response = c.post('/veranstalter/bestellung', {'evaluation-evaluieren': True, + response = c.post(f'/{get_language()}/veranstalter/bestellung', {'evaluation-evaluieren': True, "veranstalter_wizard-current_step": "evaluation"}) self.assertEqual(response.status_code, 404) def test_post_keine_evaluation(self): c = login_veranstalter(self.v) - response_firststep = c.post('/veranstalter/bestellung', {"evaluation-evaluieren": False, + response_firststep = c.post(f'/{get_language()}/veranstalter/bestellung', {"evaluation-evaluieren": False, "veranstalter_wizard-current_step": "evaluation"}) self.assertTemplateUsed(response_firststep, "formtools/wizard/zusammenfassung.html") - response_second = c.post('/veranstalter/bestellung', {"veranstalter_wizard-current_step": "zusammenfassung"}) + response_second = c.post(f'/{get_language()}/veranstalter/bestellung', {"veranstalter_wizard-current_step": "zusammenfassung"}) self.v.refresh_from_db() self.assertTemplateUsed(response_second, "formtools/wizard/bestellung_done.html") @@ -168,11 +169,11 @@ def test_post_bestellung_vollerhebung(self): self.s.save() c = login_veranstalter(self.v) - response_vollerhebung = c.get('/veranstalter/bestellung') + response_vollerhebung = c.get(f'/{get_language()}/veranstalter/bestellung') self.assertContains(response_vollerhebung, "

Information zur Vollerhebung

") - response_firststep = c.post('/veranstalter/bestellung', {"evaluation-evaluieren": True, + response_firststep = c.post(f'/{get_language()}/veranstalter/bestellung', {"evaluation-evaluieren": True, "veranstalter_wizard-current_step": "evaluation"}) self.v.refresh_from_db() @@ -185,7 +186,7 @@ def test_post_access_bestellung(self): c = login_veranstalter(self.v) - response_firststep = c.post('/veranstalter/bestellung', { + response_firststep = c.post(f'/{get_language()}/veranstalter/bestellung', { 'evaluation-evaluieren': True, "veranstalter_wizard-current_step": "evaluation" }) @@ -196,12 +197,12 @@ def test_post_access_bestellung(self): def test_post_bestellung_ein_ergebnis_empfaenger(self): c = login_veranstalter(self.v) - response_firststep = c.post('/veranstalter/bestellung', {'evaluation-evaluieren': True, + response_firststep = c.post(f'/{get_language()}/veranstalter/bestellung', {'evaluation-evaluieren': True, "veranstalter_wizard-current_step": "evaluation"}) self.assertTemplateUsed(response_firststep, "formtools/wizard/basisdaten.html") - response_second_temp_step = c.post('/veranstalter/bestellung', { + response_second_temp_step = c.post(f'/{get_language()}/veranstalter/bestellung', { "veranstalter_wizard-current_step": "basisdaten", "basisdaten-typ": "vu", "basisdaten-anzahl": 22, @@ -215,7 +216,7 @@ def test_post_bestellung_ein_ergebnis_empfaenger(self): self.assertTemplateUsed(response_second_temp_step, "formtools/wizard/digitale_evaluation.html") - response_secondstep = c.post('/veranstalter/bestellung', { + response_secondstep = c.post(f'/{get_language()}/veranstalter/bestellung', { "veranstalter_wizard-current_step": "digitale_eval", "digitale_eval-digitale_eval_type": "T", }) @@ -224,7 +225,7 @@ def test_post_bestellung_ein_ergebnis_empfaenger(self): self.assertTemplateUsed(response_secondstep, "formtools/wizard/freiefragen.html") - response_fifth_step = c.post('/veranstalter/bestellung', { + response_fifth_step = c.post(f'/{get_language()}/veranstalter/bestellung', { "veranstalter_wizard-current_step": "freie_fragen", "freie_fragen-freifrage1": "Ist das die erste Frage?", "freie_fragen-freifrage2": "Ist das die zweite Frage?" @@ -236,12 +237,12 @@ def test_post_bestellung_ein_ergebnis_empfaenger(self): self.assertTemplateUsed(response_fifth_step, "formtools/wizard/veroeffentlichen.html") - response_seventh_step = c.post('/veranstalter/bestellung', {'veroeffentlichen-veroeffentlichen': True, + response_seventh_step = c.post(f'/{get_language()}/veranstalter/bestellung', {'veroeffentlichen-veroeffentlichen': True, "veranstalter_wizard-current_step": "veroeffentlichen"}) self.assertTemplateUsed(response_seventh_step, "formtools/wizard/zusammenfassung.html") - response_eight_step = c.post('/veranstalter/bestellung', { + response_eight_step = c.post(f'/{get_language()}/veranstalter/bestellung', { "veranstalter_wizard-current_step": "zusammenfassung" }) @@ -256,10 +257,10 @@ def test_post_bestellung_ein_ergebnis_empfaenger(self): def test_post_bestellung_without_excercises(self): c = login_veranstalter(self.v_wo_excercises) - c.post('/veranstalter/bestellung', {'evaluation-evaluieren': True, + c.post(f'/{get_language()}/veranstalter/bestellung', {'evaluation-evaluieren': True, "veranstalter_wizard-current_step": "evaluation"}) - c.post('/veranstalter/bestellung', { + c.post(f'/{get_language()}/veranstalter/bestellung', { "veranstalter_wizard-current_step": "basisdaten", "basisdaten-typ": "v", "basisdaten-anzahl": 11, @@ -271,12 +272,12 @@ def test_post_bestellung_without_excercises(self): # "verantwortlicher_address" is removed - c.post('/veranstalter/bestellung', { + c.post(f'/{get_language()}/veranstalter/bestellung', { "veranstalter_wizard-current_step": "freie_fragen", "freie_fragen-freifrage1": "Ist das die erste Frage?", "freie_fragen-freifrage2": "Ist das die zweite Frage?" }) - response_fourth_step = c.post('/veranstalter/bestellung', {'veroeffentlichen-veroeffentlichen': True, + response_fourth_step = c.post(f'/{get_language()}/veranstalter/bestellung', {'veroeffentlichen-veroeffentlichen': True, "veranstalter_wizard-current_step": "veroeffentlichen"}) self.assertEqual(Tutor.objects.count(), 0) @@ -289,20 +290,20 @@ def test_post_bestellung_without_excercises(self): def test_status_changes(self): c = login_veranstalter(self.v) - c.post('/veranstalter/bestellung', {"evaluation-evaluieren": False, + c.post(f'/{get_language()}/veranstalter/bestellung', {"evaluation-evaluieren": False, "veranstalter_wizard-current_step": "evaluation"}) - c.post('/veranstalter/bestellung', {"veranstalter_wizard-current_step": "zusammenfassung"}) + c.post(f'/{get_language()}/veranstalter/bestellung', {"veranstalter_wizard-current_step": "zusammenfassung"}) self.v.refresh_from_db() self.assertFalse(self.v.evaluieren) self.assertEqual(self.v.status, Veranstaltung.STATUS_KEINE_EVALUATION) - c.post('/veranstalter/bestellung', { + c.post(f'/{get_language()}/veranstalter/bestellung', { 'evaluation-evaluieren': True, "veranstalter_wizard-current_step": "evaluation"}) - c.post('/veranstalter/bestellung', { + c.post(f'/{get_language()}/veranstalter/bestellung', { "veranstalter_wizard-current_step": "basisdaten", "basisdaten-typ": "vu", "basisdaten-anzahl": 22, @@ -314,7 +315,7 @@ def test_status_changes(self): "save": "Speichern" }) - c.post('/veranstalter/bestellung', { + c.post(f'/{get_language()}/veranstalter/bestellung', { "veranstalter_wizard-current_step": "digitale_eval", "digitale_eval-digitale_eval_type": "T", }) @@ -323,7 +324,7 @@ def test_status_changes(self): # "verantwortlicher_address" is removed - c.post('/veranstalter/bestellung', { + c.post(f'/{get_language()}/veranstalter/bestellung', { "veranstalter_wizard-current_step": "freie_fragen", "freie_fragen-freifrage1": "Ist das die erste Frage?", "freie_fragen-freifrage2": "Ist das die zweite Frage?" @@ -331,12 +332,12 @@ def test_status_changes(self): # step "tutoren" removed - c.post('/veranstalter/bestellung', { + c.post(f'/{get_language()}/veranstalter/bestellung', { 'veroeffentlichen-veroeffentlichen': True, "veranstalter_wizard-current_step": "veroeffentlichen"}) - c.post('/veranstalter/bestellung', { + c.post(f'/{get_language()}/veranstalter/bestellung', { "veranstalter_wizard-current_step": "zusammenfassung" }) @@ -346,10 +347,10 @@ def test_status_changes(self): self.assertTrue(self.v.evaluieren) self.assertEqual(self.v.status, Veranstaltung.STATUS_BESTELLUNG_LIEGT_VOR) - c.post('/veranstalter/bestellung', {"evaluation-evaluieren": False, + c.post(f'/{get_language()}/veranstalter/bestellung', {"evaluation-evaluieren": False, "veranstalter_wizard-current_step": "evaluation"}) - c.post('/veranstalter/bestellung', {"veranstalter_wizard-current_step": "zusammenfassung"}) + c.post(f'/{get_language()}/veranstalter/bestellung', {"veranstalter_wizard-current_step": "zusammenfassung"}) self.v.refresh_from_db() self.assertFalse(self.v.evaluieren) @@ -359,13 +360,13 @@ def test_status_changes(self): def test_post_bestellung_with_digital(self): c = login_veranstalter(self.v_wo_excercises) c.post( - '/veranstalter/bestellung', { + f'/{get_language()}/veranstalter/bestellung', { 'evaluation-evaluieren': True, "veranstalter_wizard-current_step": "evaluation" }) response = c.post( - '/veranstalter/bestellung', { + f'/{get_language()}/veranstalter/bestellung', { "veranstalter_wizard-current_step": "basisdaten", "basisdaten-typ": "v", "basisdaten-anzahl": 11, @@ -381,7 +382,7 @@ def test_post_bestellung_with_digital(self): "formtools/wizard/digitale_evaluation.html") response = c.post( - '/veranstalter/bestellung', { + f'/{get_language()}/veranstalter/bestellung', { "veranstalter_wizard-current_step": "digitale_eval", "digitale_eval-digitale_eval_type": "L", }) @@ -391,18 +392,18 @@ def test_post_bestellung_with_digital(self): # step "verantwortlicher_address" removed c.post( - '/veranstalter/bestellung', { + f'/{get_language()}/veranstalter/bestellung', { "veranstalter_wizard-current_step": "freie_fragen", "freie_fragen-freifrage1": "Ist das die erste Frage?", "freie_fragen-freifrage2": "Ist das die zweite Frage?" }) c.post( - '/veranstalter/bestellung', { + f'/{get_language()}/veranstalter/bestellung', { 'veroeffentlichen-veroeffentlichen': True, "veranstalter_wizard-current_step": "veroeffentlichen" }) - c.post('/veranstalter/bestellung', + c.post(f'/{get_language()}/veranstalter/bestellung', {"veranstalter_wizard-current_step": "zusammenfassung"}) self.v_wo_excercises.refresh_from_db() diff --git a/src/feedback/tests/tools.py b/src/feedback/tests/tools.py index 058433e..fbc80ad 100644 --- a/src/feedback/tests/tools.py +++ b/src/feedback/tests/tools.py @@ -7,7 +7,7 @@ from feedback.models import Veranstaltung, Semester from feedback import tests - +from django.utils.translation import get_language class NonSuTestMixin(TransactionTestCase): def setUp(self): @@ -42,7 +42,7 @@ def get_veranstaltung(typ): def login_veranstalter(v): c = Client() - response = c.get('/veranstalter/login/', {'vid': v.id, 'token': v.access_token}) + response = c.get(f'/{get_language()}/veranstalter/login/', {'vid': v.id, 'token': v.access_token}) if response.status_code != 302: raise Exception('Veranstalter-Login fehlgeschlagen.') return c diff --git a/src/feedback/urls.py b/src/feedback/urls.py new file mode 100644 index 0000000..2be500d --- /dev/null +++ b/src/feedback/urls.py @@ -0,0 +1,103 @@ +# coding=utf-8 + +from django.conf.urls import include +from django.contrib.staticfiles.urls import staticfiles_urlpatterns + +import feedback.views.public +import feedback.views.veranstalter +from feedback.views.public_class_view import VeranstaltungsDeadlines +import feedback.views.intern +import feedback.views.intern.vv +import feedback.views.intern.auth +from django.views.decorators.csrf import csrf_exempt +import django.contrib.auth.views +from django.urls import reverse_lazy, re_path +from django.conf import settings +from feedback.views.veranstalter import VeranstalterWizard + + +if not settings.DEBUG: + default_redirect = '/feedback-new/' +else: + default_redirect = '/veranstalter/' + +# allgemeine Views +urlpatterns = [ + re_path(r'^$', feedback.views.redirect, {'redirect_to': default_redirect}), +] + +# öffentliche Views +urlpatterns += [ + re_path(r'^ergebnisse/(?P\d+)/$', feedback.views.public.veranstaltung, name='public-veranstaltung'), + re_path(r'^ergebnisse/$', feedback.views.public.index, name='public-results'), +] + +urlpatterns += [re_path(r'^deadlines/$', VeranstaltungsDeadlines.as_view(), name='Deadlines'), + re_path(r'^barcodedrop/$', csrf_exempt(feedback.views.public.barcodedrop), name='barcodedrop'),] + + +# Veranstalter-Views +urlpatterns += [ + re_path(r'^veranstalter/login/$', feedback.views.veranstalter.login, name='veranstalter-login'), + re_path(r'^veranstalter/logout/$', + django.contrib.auth.views.LogoutView.as_view(), + {'template_name': "veranstalter/logout.html"}, + name='veranstalter-logout'), + + re_path(r'^veranstalter/bestellung', VeranstalterWizard.as_view(), name='veranstalter-bestellung'), + re_path(r'^veranstalter/', feedback.views.veranstalter.veranstalter_dashboard, name='veranstalter-index') +] + +# interne Views +urlpatterns += [ + re_path(r'^intern/uebersicht/$', feedback.views.intern.index, name='intern-index'), + re_path(r'^intern/sendmail/$', feedback.views.intern.sendmail, name='sendmail'), + re_path(r'^intern/export_veranstaltungen/$', feedback.views.intern.export_veranstaltungen, name='export_veranstaltungen'), + re_path(r'^intern/generate_letters/$', feedback.views.intern.generate_letters, name='generate_letters'), + re_path(r'^intern/import_ergebnisse/$', feedback.views.intern.import_ergebnisse, name='import_ergebnisse'), + re_path(r'^intern/status_final/$', feedback.views.intern.CloseOrderFormView.as_view(), name='status_final'), + re_path(r'^intern/sync_ergebnisse/$', feedback.views.intern.sync_ergebnisse, name='sync_ergebnisse'), + re_path(r'^intern/fragebogensprache/$', feedback.views.intern.fragebogensprache, name='fragebogensprache'), + re_path(r'^intern/lange_ohne_evaluation/$', feedback.views.intern.lange_ohne_evaluation, name='lange_ohne_evaluation'), + re_path(r'^intern/ergebnisse/$', feedback.views.intern.ergebnisse, name='intern-ergebnisse'), + re_path(r'^intern/tans/$', feedback.views.intern.ProcessTANs.as_view(), + name='process-tans'), +] + +# interne Views: Vorlesungsverzeichnis +urlpatterns += [ + re_path(r'^intern/import_vv/$', feedback.views.intern.vv.import_vv, name='import_vv'), + re_path(r'^intern/import_vv_edit/$', feedback.views.intern.vv.import_vv_edit, name='import_vv_edit'), + re_path(r'^intern/import_vv_edit_users/$', feedback.views.intern.vv.PersonFormView.as_view(), + name='import_vv_edit_users'), + re_path(r'^intern/import_vv_edit_users/(?P\d+)/$', feedback.views.intern.vv.PersonFormUpdateView.as_view(), + name='import_vv_edit_users_update'), + re_path(r'^intern/import_vv_edit_users/(?P\d+)/namecheck/$', feedback.views.intern.vv.SimilarNamesView.as_view(), + name='import_vv_edit_users_update_namecheck') +] + +# interne Views: Authentifizierung +urlpatterns += [ + re_path(r'^intern/rechte_uebernehmen/$', feedback.views.intern.auth.rechte_uebernehmen, name='rechte-uebernehmen'), + re_path(r'^intern/rechte_zuruecknehmen/$', feedback.views.intern.auth.rechte_zuruecknehmen, name='rechte_zuruecknehmen'), + re_path(r'^intern/$', feedback.views.intern.auth.login, name='auth-login'), +] + +# Logout +urlpatterns += [ + re_path(r'^logout/$', django.contrib.auth.views.LogoutView.as_view(), {'next_page': reverse_lazy('public-results')}, name='logout'), +] + +urlpatterns += staticfiles_urlpatterns() + +if settings.DEBUG: + # Ausschließlich in der Entwicklung nötig, damit statische Dateien (JS, CSS, Bilder...) + # angezeigt werden. Im Server-Betrieb kümmert sich Apache darum. + urlpatterns += [ + re_path(r'^d120de/(?P.*)$', feedback.views.redirect, {'redirect_to': 'http://www.d120.de/d120de/'}), + ] + + import debug_toolbar + urlpatterns += [ + re_path(r'^__debug__/', include(debug_toolbar.urls)), + ] diff --git a/src/settings.py b/src/settings.py index e48a522..042c48e 100644 --- a/src/settings.py +++ b/src/settings.py @@ -39,13 +39,17 @@ # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html -LANGUAGE_CODE = 'de-DE' +LANGUAGE_CODE = 'de-de' LANGUAGES = [ - ("de", _("German")), - ("en", _("English")), + ("de-de", _("German")), + ("en-us", _("English")), ] +LOCALE_PATHS = ( + os.path.join(BASE_PATH, 'src/locale'), +) + SITE_ID = 1 # If you set this to False, Django will make some optimizations so as not diff --git a/src/urls.py b/src/urls.py index fd968c6..6ca7d18 100644 --- a/src/urls.py +++ b/src/urls.py @@ -3,114 +3,19 @@ from django.conf.urls import include from django.contrib import admin from django.contrib.auth.models import User -from django.contrib.staticfiles.urls import staticfiles_urlpatterns - -import feedback.views.public -import feedback.views.veranstalter -from feedback.views.public_class_view import VeranstaltungsDeadlines -import feedback.views.intern -import feedback.views.intern.vv -import feedback.views.intern.auth -from django.views.decorators.csrf import csrf_exempt -import django.contrib.auth.views -from django.urls import reverse_lazy, re_path -from django.conf import settings -from feedback.views.veranstalter import VeranstalterWizard +from django.urls import re_path +from django.conf.urls.i18n import i18n_patterns # Admin-Seiten konfigurieren admin.autodiscover() # admin.site.unregister((User, Group)) -if not settings.DEBUG: - default_redirect = '/feedback-new/' -else: - default_redirect = '/veranstalter/' - # Datenbank-Admin und Entwicklerdoku -urlpatterns = [ +urlpatterns = i18n_patterns( # Muss in dieser Reihenfolge stehen bleiben, da sonst /doc nicht funktioniert! re_path(r'^intern/admin/doc/', include('django.contrib.admindocs.urls')), re_path(r'^intern/admin/', admin.site.urls), -] - -# allgemeine Views -urlpatterns += [ - re_path(r'^$', feedback.views.redirect, {'redirect_to': default_redirect}), -] - -# öffentliche Views -urlpatterns += [ - re_path(r'^ergebnisse/(?P\d+)/$', feedback.views.public.veranstaltung, name='public-veranstaltung'), - re_path(r'^ergebnisse/$', feedback.views.public.index, name='public-results'), -] - -urlpatterns += [re_path(r'^deadlines/$', VeranstaltungsDeadlines.as_view(), name='Deadlines'), - re_path(r'^barcodedrop/$', csrf_exempt(feedback.views.public.barcodedrop), name='barcodedrop'),] - - -# Veranstalter-Views -urlpatterns += [ - re_path(r'^veranstalter/login/$', feedback.views.veranstalter.login, name='veranstalter-login'), - re_path(r'^veranstalter/logout/$', - django.contrib.auth.views.LogoutView.as_view(), - {'template_name': "veranstalter/logout.html"}, - name='veranstalter-logout'), - - re_path(r'^veranstalter/bestellung', VeranstalterWizard.as_view(), name='veranstalter-bestellung'), - re_path(r'^veranstalter/', feedback.views.veranstalter.veranstalter_dashboard, name='veranstalter-index') -] - -# interne Views -urlpatterns += [ - re_path(r'^intern/uebersicht/$', feedback.views.intern.index, name='intern-index'), - re_path(r'^intern/sendmail/$', feedback.views.intern.sendmail, name='sendmail'), - re_path(r'^intern/export_veranstaltungen/$', feedback.views.intern.export_veranstaltungen, name='export_veranstaltungen'), - re_path(r'^intern/generate_letters/$', feedback.views.intern.generate_letters, name='generate_letters'), - re_path(r'^intern/import_ergebnisse/$', feedback.views.intern.import_ergebnisse, name='import_ergebnisse'), - re_path(r'^intern/status_final/$', feedback.views.intern.CloseOrderFormView.as_view(), name='status_final'), - re_path(r'^intern/sync_ergebnisse/$', feedback.views.intern.sync_ergebnisse, name='sync_ergebnisse'), - re_path(r'^intern/fragebogensprache/$', feedback.views.intern.fragebogensprache, name='fragebogensprache'), - re_path(r'^intern/lange_ohne_evaluation/$', feedback.views.intern.lange_ohne_evaluation, name='lange_ohne_evaluation'), - re_path(r'^intern/ergebnisse/$', feedback.views.intern.ergebnisse, name='intern-ergebnisse'), - re_path(r'^intern/tans/$', feedback.views.intern.ProcessTANs.as_view(), - name='process-tans'), -] - -# interne Views: Vorlesungsverzeichnis -urlpatterns += [ - re_path(r'^intern/import_vv/$', feedback.views.intern.vv.import_vv, name='import_vv'), - re_path(r'^intern/import_vv_edit/$', feedback.views.intern.vv.import_vv_edit, name='import_vv_edit'), - re_path(r'^intern/import_vv_edit_users/$', feedback.views.intern.vv.PersonFormView.as_view(), - name='import_vv_edit_users'), - re_path(r'^intern/import_vv_edit_users/(?P\d+)/$', feedback.views.intern.vv.PersonFormUpdateView.as_view(), - name='import_vv_edit_users_update'), - re_path(r'^intern/import_vv_edit_users/(?P\d+)/namecheck/$', feedback.views.intern.vv.SimilarNamesView.as_view(), - name='import_vv_edit_users_update_namecheck') -] - -# interne Views: Authentifizierung -urlpatterns += [ - re_path(r'^intern/rechte_uebernehmen/$', feedback.views.intern.auth.rechte_uebernehmen, name='rechte-uebernehmen'), - re_path(r'^intern/rechte_zuruecknehmen/$', feedback.views.intern.auth.rechte_zuruecknehmen, name='rechte_zuruecknehmen'), - re_path(r'^intern/$', feedback.views.intern.auth.login, name='auth-login'), -] - -# Logout -urlpatterns += [ - re_path(r'^logout/$', django.contrib.auth.views.LogoutView.as_view(), {'next_page': reverse_lazy('public-results')}, name='logout'), -] - -urlpatterns += staticfiles_urlpatterns() - -if settings.DEBUG: - # Ausschließlich in der Entwicklung nötig, damit statische Dateien (JS, CSS, Bilder...) - # angezeigt werden. Im Server-Betrieb kümmert sich Apache darum. - urlpatterns += [ - re_path(r'^d120de/(?P.*)$', feedback.views.redirect, {'redirect_to': 'http://www.d120.de/d120de/'}), - ] + re_path(r"^", include("feedback.urls")), +) - import debug_toolbar - urlpatterns += [ - re_path(r'^__debug__/', include(debug_toolbar.urls)), - ]