Skip to content

Commit

Permalink
Merge pull request #305 from d120/updating_dependencies
Browse files Browse the repository at this point in the history
Updating dependencies
  • Loading branch information
joachimschmidt557 authored Aug 31, 2024
2 parents 47060d7 + b5424e9 commit 83303ff
Show file tree
Hide file tree
Showing 12 changed files with 84 additions and 58 deletions.
10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
coverage==6.3.3
Django==2.2.28
django-debug-toolbar==3.2.4
docutils==0.20.1
freezegun==1.2.2
django-formtools==2.3
Django==5.1
django-debug-toolbar==4.4.6
docutils==0.21.2
freezegun==1.5.1
django-formtools==2.5.1
6 changes: 3 additions & 3 deletions src/feedback/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def assign_fachgebiet_action(self, request, queryset):

if not form:
form = self.FachgebietZuweisenForm(initial={
'_selected_action': request.POST.getlist(admin.ACTION_CHECKBOX_NAME)
'_selected_action': queryset.values_list('id', flat=True)
})

return render(request, 'admin/fachgebiet.html', {'data': suggestion_list, 'fachgebiet': form, })
Expand Down Expand Up @@ -121,7 +121,7 @@ def status_aendern_action(self, request, queryset):
return HttpResponseRedirect(request.get_full_path())

if not form:
form = self.StatusAendernForm(initial={'_selected_action': request.POST.getlist(admin.ACTION_CHECKBOX_NAME)})
form = self.StatusAendernForm(initial={'_selected_action': queryset.values_list('id', flat=True)})

return render(request, 'admin/status_aendern.html', {'veranstaltungen': queryset, 'status': form, })

Expand All @@ -145,7 +145,7 @@ def keine_evaluation_action(self, request, queryset):
return HttpResponseRedirect(request.get_full_path())
# nach dem return landet Python in status_aendern_action
if not form:
form = self.KeineEvaluationForm(initial={'_selected_action': request.POST.getlist(admin.ACTION_CHECKBOX_NAME)})
form = self.KeineEvaluationForm(initial={'_selected_action': queryset.values_list('id', flat=True)})
return render(request, 'admin/keine_evaluation.html', {'veranstaltungen': queryset, 'status': form, })

keine_evaluation_action.short_description = "Keine Evaluation für diese Veranstaltung(en)"
Expand Down
6 changes: 3 additions & 3 deletions src/feedback/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from django.contrib.auth.models import User
from django.contrib.auth.backends import RemoteUserBackend, ModelBackend
from django.contrib.auth.middleware import RemoteUserMiddleware
from django.utils.encoding import smart_text
from django.utils.encoding import smart_str

from feedback.models.base import Veranstaltung

Expand Down Expand Up @@ -38,7 +38,7 @@ def authenticate(self, request, user, current_user=None, reset=False):
class FSAccountBackend(RemoteUserBackend):
# Login wird automatisch über RemoteUserMiddleware bzw. RemoteUserBackend abgewickelt,
# hier muss nur noch der neue User konfiguriert werden.
def configure_user(self, user):
def configure_user(self, request, user, created=True):
user.email = user.username + '@d120.de'
user.is_staff = True
user.is_superuser = True
Expand All @@ -52,7 +52,7 @@ def clean_username(self, username):
if settings.DEBUG:
credentials = str(b64decode(username.split()[1]))
user = credentials.split(':')[0]
return (smart_text(user))
return (smart_str(user))
else:
return username

Expand Down
18 changes: 18 additions & 0 deletions src/feedback/migrations/0052_auto_20240817_2346.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.0.14 on 2024-08-17 23:46

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('feedback', '0051_auto_20230604_1734'),
]

operations = [
migrations.AlterField(
model_name='importveranstaltung',
name='typ',
field=models.CharField(choices=[('v', 'Vorlesung'), ('vu', 'Vorlesung mit Übung'), ('pr', 'Praktikum'), ('se', 'Seminar')], max_length=2),
),
]
2 changes: 1 addition & 1 deletion src/feedback/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import random

from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.db.utils import OperationalError
from django.urls import reverse
from django.core.exceptions import ValidationError
Expand Down
2 changes: 1 addition & 1 deletion src/feedback/models/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Meta:


class ImportVeranstaltung(models.Model):
typ = models.CharField(max_length=1, choices=Veranstaltung.TYP_CHOICES)
typ = models.CharField(max_length=2, choices=Veranstaltung.TYP_CHOICES)
name = models.CharField(max_length=150)
lv_nr = models.CharField(max_length=15, blank=True)
veranstalter = models.ManyToManyField(ImportPerson, blank=True)
Expand Down
6 changes: 3 additions & 3 deletions src/feedback/tests/redirect_urls.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# coding=utf-8

from django.conf.urls import url
from django.urls import re_path
from feedback.views import redirect

urlpatterns = [
url(r'^redirect/$', redirect,
re_path(r'^redirect/$', redirect,
{'redirect_to': 'http://www.d120.de/'}),
url(r'^redirect/(?P<tail>.*)$', redirect,
re_path(r'^redirect/(?P<tail>.*)$', redirect,
{'redirect_to': 'http://www.d120.de/'}),
]
2 changes: 1 addition & 1 deletion src/feedback/tests/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ def setUp(self):
self.u = User.objects.create_user('brian')

def test_configure_user(self):
self.assertTrue(self.b.configure_user(self.u).is_superuser)
self.assertTrue(self.b.configure_user(None, self.u).is_superuser)
u_db = User.objects.get(username='brian')
self.assertTrue(u_db.is_superuser)
14 changes: 9 additions & 5 deletions src/feedback/views/veranstalter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from django.http import HttpResponseRedirect, Http404
from django.urls import reverse
from django.shortcuts import render
from django.shortcuts import render_to_response
from django.core.mail import send_mail
from django.template.loader import render_to_string

Expand Down Expand Up @@ -189,7 +188,7 @@ def get_context_data(self, form, **kwargs):

progressbar = []
step_active = True
for step_key in self.form_list:
for step_key in self.get_form_list():
progressbar.append({
'step_value': VERANSTALTER_WIZARD_STEPS[step_key],
'step_active': step_active,
Expand All @@ -206,7 +205,7 @@ def get_context_data(self, form, **kwargs):

if self.steps.current == "zusammenfassung":
all_form_data = []
for step_form in self.form_list:
for step_form in self.get_form_list():
form_obj = self.get_form(
step=step_form,
data=self.storage.get_step_data(step_form),
Expand Down Expand Up @@ -256,7 +255,11 @@ def get_template_names(self):
return [VERANSTALTER_VIEW_TEMPLATES[self.steps.current]]

def done(self, form_list, **kwargs):
cleaned_data = self.get_cleaned_basisdaten()
cleaned_data = {}
if perform_evalution(self) :
# django-formtools uses get_form_list to get steps, which are added when their method in condition_dict is True
# get_cleaned_basisdaten uses step 'basisdaten', which is not added to steps if perform_evalution is False
cleaned_data = self.get_cleaned_basisdaten()
ergebnis_empfaenger = cleaned_data.get('ergebnis_empfaenger', None)

instance = self.get_instance()
Expand All @@ -265,7 +268,8 @@ def done(self, form_list, **kwargs):
context = self.get_context_data('zusammenfassung')
send_mail_to_verantwortliche(ergebnis_empfaenger, context, instance)

return render_to_response('formtools/wizard/bestellung_done.html', )
return render(request=None, template_name='formtools/wizard/bestellung_done.html', )



def send_mail_to_verantwortliche(ergebnis_empfaenger, context, veranstaltung):
Expand Down
4 changes: 4 additions & 0 deletions src/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
# system time zone.
TIME_ZONE = 'Europe/Berlin'

USE_TZ = False # before django 5.0 USE_TZ was default False

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'de-DE'
Expand Down Expand Up @@ -203,6 +205,8 @@
DEFAULT_FROM_EMAIL = "Feedback-Team <[email protected]>"
SERVER_EMAIL = DEFAULT_FROM_EMAIL

DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'

USERNAME_VERANSTALTER = 'veranstalter'

# for debug toolbar
Expand Down
2 changes: 1 addition & 1 deletion src/templates/d120/header.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% load staticfiles %}
{% load static %}
<nav class="navbar navbar-logos">
<div class="container" id="header">
<a href="https://www.fachschaft.informatik.tu-darmstadt.de"><img src="https://www.fachschaft.informatik.tu-darmstadt.de/static/d120/img/d120_logo.png" id="mainLogo" alt="D120: Fachschaft Informatik" class="pull-left"></a>
Expand Down
70 changes: 35 additions & 35 deletions src/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding=utf-8

from django.conf.urls import include, url
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
Expand All @@ -13,7 +13,7 @@
import feedback.views.intern.auth
from django.views.decorators.csrf import csrf_exempt
import django.contrib.auth.views
from django.urls import reverse_lazy
from django.urls import reverse_lazy, re_path
from django.conf import settings
from feedback.views.veranstalter import VeranstalterWizard

Expand All @@ -30,75 +30,75 @@
# Datenbank-Admin und Entwicklerdoku
urlpatterns = [
# Muss in dieser Reihenfolge stehen bleiben, da sonst /doc nicht funktioniert!
url(r'^intern/admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^intern/admin/', admin.site.urls),
re_path(r'^intern/admin/doc/', include('django.contrib.admindocs.urls')),
re_path(r'^intern/admin/', admin.site.urls),
]

# allgemeine Views
urlpatterns += [
url(r'^$', feedback.views.redirect, {'redirect_to': default_redirect}),
re_path(r'^$', feedback.views.redirect, {'redirect_to': default_redirect}),
]

# öffentliche Views
urlpatterns += [
url(r'^ergebnisse/(?P<vid>\d+)/$', feedback.views.public.veranstaltung, name='public-veranstaltung'),
url(r'^ergebnisse/$', feedback.views.public.index, name='public-results'),
re_path(r'^ergebnisse/(?P<vid>\d+)/$', feedback.views.public.veranstaltung, name='public-veranstaltung'),
re_path(r'^ergebnisse/$', feedback.views.public.index, name='public-results'),
]

urlpatterns += [url(r'^deadlines/$', VeranstaltungsDeadlines.as_view(), name='Deadlines'),
url(r'^barcodedrop/$', csrf_exempt(feedback.views.public.barcodedrop), name='barcodedrop'),]
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 += [
url(r'^veranstalter/login/$', feedback.views.veranstalter.login, name='veranstalter-login'),
url(r'^veranstalter/logout/$',
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'),

url(r'^veranstalter/bestellung', VeranstalterWizard.as_view(), name='veranstalter-bestellung'),
url(r'^veranstalter/', feedback.views.veranstalter.veranstalter_dashboard, name='veranstalter-index')
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 += [
url(r'^intern/uebersicht/$', feedback.views.intern.index, name='intern-index'),
url(r'^intern/sendmail/$', feedback.views.intern.sendmail, name='sendmail'),
url(r'^intern/export_veranstaltungen/$', feedback.views.intern.export_veranstaltungen, name='export_veranstaltungen'),
url(r'^intern/generate_letters/$', feedback.views.intern.generate_letters, name='generate_letters'),
url(r'^intern/import_ergebnisse/$', feedback.views.intern.import_ergebnisse, name='import_ergebnisse'),
url(r'^intern/status_final/$', feedback.views.intern.CloseOrderFormView.as_view(), name='status_final'),
url(r'^intern/sync_ergebnisse/$', feedback.views.intern.sync_ergebnisse, name='sync_ergebnisse'),
url(r'^intern/fragebogensprache/$', feedback.views.intern.fragebogensprache, name='fragebogensprache'),
url(r'^intern/lange_ohne_evaluation/$', feedback.views.intern.lange_ohne_evaluation, name='lange_ohne_evaluation'),
url(r'^intern/ergebnisse/$', feedback.views.intern.ergebnisse, name='intern-ergebnisse'),
url(r'^intern/tans/$', feedback.views.intern.ProcessTANs.as_view(),
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 += [
url(r'^intern/import_vv/$', feedback.views.intern.vv.import_vv, name='import_vv'),
url(r'^intern/import_vv_edit/$', feedback.views.intern.vv.import_vv_edit, name='import_vv_edit'),
url(r'^intern/import_vv_edit_users/$', feedback.views.intern.vv.PersonFormView.as_view(),
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'),
url(r'^intern/import_vv_edit_users/(?P<pk>\d+)/$', feedback.views.intern.vv.PersonFormUpdateView.as_view(),
re_path(r'^intern/import_vv_edit_users/(?P<pk>\d+)/$', feedback.views.intern.vv.PersonFormUpdateView.as_view(),
name='import_vv_edit_users_update'),
url(r'^intern/import_vv_edit_users/(?P<pk>\d+)/namecheck/$', feedback.views.intern.vv.SimilarNamesView.as_view(),
re_path(r'^intern/import_vv_edit_users/(?P<pk>\d+)/namecheck/$', feedback.views.intern.vv.SimilarNamesView.as_view(),
name='import_vv_edit_users_update_namecheck')
]

# interne Views: Authentifizierung
urlpatterns += [
url(r'^intern/rechte_uebernehmen/$', feedback.views.intern.auth.rechte_uebernehmen, name='rechte-uebernehmen'),
url(r'^intern/rechte_zuruecknehmen/$', feedback.views.intern.auth.rechte_zuruecknehmen, name='rechte_zuruecknehmen'),
url(r'^intern/$', feedback.views.intern.auth.login, name='auth-login'),
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 += [
url(r'^logout/$', django.contrib.auth.views.LogoutView.as_view(), {'next_page': reverse_lazy('public-results')}, name='logout'),
re_path(r'^logout/$', django.contrib.auth.views.LogoutView.as_view(), {'next_page': reverse_lazy('public-results')}, name='logout'),
]

urlpatterns += staticfiles_urlpatterns()
Expand All @@ -107,10 +107,10 @@
# Ausschließlich in der Entwicklung nötig, damit statische Dateien (JS, CSS, Bilder...)
# angezeigt werden. Im Server-Betrieb kümmert sich Apache darum.
urlpatterns += [
url(r'^d120de/(?P<tail>.*)$', feedback.views.redirect, {'redirect_to': 'http://www.d120.de/d120de/'}),
re_path(r'^d120de/(?P<tail>.*)$', feedback.views.redirect, {'redirect_to': 'http://www.d120.de/d120de/'}),
]

import debug_toolbar
urlpatterns += [
url(r'^__debug__/', include(debug_toolbar.urls)),
re_path(r'^__debug__/', include(debug_toolbar.urls)),
]

0 comments on commit 83303ff

Please sign in to comment.