Skip to content
Snippets Groups Projects
Commit c18474c9 authored by Jonathan Weth's avatar Jonathan Weth :keyboard: Committed by root
Browse files

Merge pull request #334 from Katharineum/feature/show-class-teachers

Show class teachers on plan views
parents 3f433dab 634fce4a
No related branches found
No related tags found
1 merge request!86Merge school-apps
......@@ -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
......@@ -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">
......
......@@ -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={
......
......@@ -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">
......
......@@ -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"),
......
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")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment