diff --git a/.idea/misc.xml b/.idea/misc.xml index f967d638a7fcfd76693951f28f989c088f769539..7c7709e01ee2155b7c0a4e707b518b02f2274eb5 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -6,5 +6,5 @@ <component name="NodePackageJsonFileManager"> <packageJsonPaths /> </component> - <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (SchoolApps)" project-jdk-type="Python SDK" /> + <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (school-apps)" project-jdk-type="Python SDK" /> </project> \ No newline at end of file diff --git a/.idea/school-apps.iml b/.idea/school-apps.iml index 96873b7da10fa79cb630f41924905744bec63b0c..60fb427d477958236a96ce6b6d249cbf6097e7a2 100644 --- a/.idea/school-apps.iml +++ b/.idea/school-apps.iml @@ -23,7 +23,7 @@ <excludeFolder url="file://$MODULE_DIR$/env" /> <excludeFolder url="file://$MODULE_DIR$/schoolapps/staticcollect" /> </content> - <orderEntry type="jdk" jdkName="Python 3.7 (SchoolApps)" jdkType="Python SDK" /> + <orderEntry type="jdk" jdkName="Python 3.7 (school-apps)" jdkType="Python SDK" /> <orderEntry type="sourceFolder" forTests="false" /> </component> <component name="TemplatesService"> diff --git a/requirements.txt b/requirements.txt index 95162f578fab706905d1cf1eb69c600d9ee99046..e760b444ea85230fa371ede00451160a5bbd353e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ requests mysqlclient -django +django<3.0 django-auth-ldap django-dbsettings django-pdb diff --git a/schoolapps/dashboard/migrations/0002_cache.py b/schoolapps/dashboard/migrations/0002_cache.py index 55ee00afe0e0c57fac5e0e62773131ec36a52309..1d146b35c7961c326f2b7de0bcf33ea6bdb552a5 100644 --- a/schoolapps/dashboard/migrations/0002_cache.py +++ b/schoolapps/dashboard/migrations/0002_cache.py @@ -13,8 +13,8 @@ class Migration(migrations.Migration): name='Cache', fields=[ ('id', - models.CharField(max_length=200, primary_key=True, serialize=False, unique=True, verbose_name='ID')), - ('name', models.CharField(max_length=200, verbose_name='Name')), + models.CharField(max_length=150, primary_key=True, serialize=False, unique=True, verbose_name='ID')), + ('name', models.CharField(max_length=150, verbose_name='Name')), ('expiration_time', models.IntegerField(default=20, verbose_name='Ablaufzeit')), ], options={ diff --git a/schoolapps/timetable/templates/timetable/plan.html b/schoolapps/timetable/templates/timetable/plan.html index 9874ea7b4aa8e2484a6a8c9b505af70a16d5562b..07a8aeef0fc284bfe37ebff502863a262e5cc49f 100755 --- a/schoolapps/timetable/templates/timetable/plan.html +++ b/schoolapps/timetable/templates/timetable/plan.html @@ -43,6 +43,19 @@ <h3> Stundenplan <i>{{ el }}</i> </h3> + + {# Show class teacher and deputy class teacher #} + {% if type == 2 and el.teachers %} + <h5>Klassenlehrkräfte: + {% for teacher in el.teachers %} + + <span data-position="bottom" class="tooltipped" + data-tooltip="{{ teacher }}"> + <a href="{% url "timetable_smart_plan" "teacher" teacher.id %}"> + {{ teacher.shortcode }}</a></span>{% if not forloop.last %},{% endif %} + {% endfor %} + </h5> + {% endif %} </div> {# Show print button only if not on mobile #} <div class="col s4 m6 l4 xl3 right align-right no-print"> diff --git a/schoolapps/timetable/urls.py b/schoolapps/timetable/urls.py index 1a8f979a2854425a642fe53b460ef7db7dd60d99..704099725ade72bee9057fd52bec6f6de3126cfd 100755 --- a/schoolapps/timetable/urls.py +++ b/schoolapps/timetable/urls.py @@ -27,8 +27,9 @@ try: path('<str:plan_date>-aktuell.pdf', views.sub_pdf, name="timetable_substitutions_pdf_date") ] -except (Terms.DoesNotExist, Schoolyear.DoesNotExist, ProgrammingError, OperationalError): +except (Terms.DoesNotExist, Schoolyear.DoesNotExist, ProgrammingError, OperationalError) as e: from . import fallback_view + print(e) urlpatterns = [ path('hints', fallback_view.fallback, name="timetable_hints"), diff --git a/schoolapps/untisconnect/api.py b/schoolapps/untisconnect/api.py index 313067603011e3d4a493980e98c36c0e60e4c686..767e5b599a9eb51ecf26c683228de34fa714dd7c 100755 --- a/schoolapps/untisconnect/api.py +++ b/schoolapps/untisconnect/api.py @@ -1,6 +1,7 @@ from django.conf import settings -from untisconnect.api_helper import get_term_by_ids, run_using, untis_date_to_date, date_to_untis_date +from untisconnect.api_helper import get_term_by_ids, run_using, untis_date_to_date, date_to_untis_date, \ + untis_split_first from . import models from timetable.settings import untis_settings @@ -8,8 +9,6 @@ TYPE_TEACHER = 0 TYPE_ROOM = 1 TYPE_CLASS = 2 -from datetime import date - def run_all(obj, filter_term=True): return run_default_filter(run_using(obj).all(), filter_term=filter_term) @@ -118,6 +117,7 @@ class Class(object): self.text1 = None self.text2 = None self.room = None + self.teachers = [] def __str__(self): if self.filled: @@ -138,6 +138,9 @@ class Class(object): self.name = db_obj.name self.text1 = db_obj.longname self.text2 = db_obj.text + teacher_ids = untis_split_first(db_obj.teacherids, int) + self.teachers = [get_teacher_by_id(t_id) for t_id in teacher_ids] + print(self.teachers) # print(db_obj.room_id) if db_obj.room_id != 0: # print("RAUM")