Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Chronos
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-App-Chronos
Commits
3b61686f
Verified
Commit
3b61686f
authored
4 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into feature/show-week-on-desktop
parents
3c235a8a
6e35c3e5
No related branches found
No related tags found
1 merge request
!117
Show full timetable on my timetable on desktop
Pipeline
#5104
passed
4 years ago
Stage: test
Stage: build
Changes
3
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
aleksis/apps/chronos/models.py
+16
-2
16 additions, 2 deletions
aleksis/apps/chronos/models.py
aleksis/apps/chronos/views.py
+2
-0
2 additions, 0 deletions
aleksis/apps/chronos/views.py
poetry.lock
+203
-179
203 additions, 179 deletions
poetry.lock
with
221 additions
and
181 deletions
aleksis/apps/chronos/models.py
+
16
−
2
View file @
3b61686f
...
...
@@ -468,6 +468,20 @@ class LessonPeriod(ExtensibleModel, WeekAnnotationMixin):
def
__str__
(
self
)
->
str
:
return
f
"
{
self
.
period
}
,
{
self
.
lesson
}
"
@property
def
_equal_lessons
(
self
):
"""
Get all lesson periods with equal lessons in the whole school term.
"""
qs
=
LessonPeriod
.
objects
.
filter
(
lesson__subject
=
self
.
lesson
.
subject
,
lesson__validity__school_term
=
self
.
lesson
.
validity
.
school_term
,
)
for
group
in
self
.
lesson
.
groups
.
all
():
qs
=
qs
.
filter
(
lesson__groups
=
group
)
for
teacher
in
self
.
lesson
.
teachers
.
all
():
qs
=
qs
.
filter
(
lesson__teachers
=
teacher
)
return
qs
@property
def
next
(
self
)
->
"
LessonPeriod
"
:
"""
Get next lesson period of this lesson.
...
...
@@ -475,7 +489,7 @@ class LessonPeriod(ExtensibleModel, WeekAnnotationMixin):
.. warning::
To use this property, the provided lesson period must be annotated with a week.
"""
return
LessonPeriod
.
objects
.
filter
(
lesson
=
self
.
lesson
)
.
next_lesson
(
self
)
return
self
.
_equal_lessons
.
next_lesson
(
self
)
@property
def
prev
(
self
)
->
"
LessonPeriod
"
:
...
...
@@ -484,7 +498,7 @@ class LessonPeriod(ExtensibleModel, WeekAnnotationMixin):
.. warning::
To use this property, the provided lesson period must be annotated with a week.
"""
return
LessonPeriod
.
objects
.
filter
(
lesson
=
self
.
lesson
)
.
next_lesson
(
self
,
-
1
)
return
self
.
_equal_lessons
.
next_lesson
(
self
,
-
1
)
class
Meta
:
ordering
=
[
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/chronos/views.py
+
2
−
0
View file @
3b61686f
...
...
@@ -7,6 +7,7 @@ from django.shortcuts import get_object_or_404, redirect, render
from
django.urls
import
reverse
from
django.utils
import
timezone
from
django.utils.translation
import
ugettext
as
_
from
django.views.decorators.cache
import
never_cache
from
django_tables2
import
RequestConfig
from
rules.contrib.views
import
permission_required
...
...
@@ -226,6 +227,7 @@ def lessons_day(
return
render
(
request
,
"
chronos/lessons_day.html
"
,
context
)
@never_cache
@permission_required
(
"
chronos.edit_substitution
"
,
fn
=
get_substitution_by_id
)
def
edit_substitution
(
request
:
HttpRequest
,
id_
:
int
,
week
:
int
)
->
HttpResponse
:
"""
View a form to edit a substitution lessen.
"""
...
...
This diff is collapsed.
Click to expand it.
poetry.lock
+
203
−
179
View file @
3b61686f
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment