Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Alsijil
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-Alsijil
Commits
d2159489
Commit
d2159489
authored
10 months ago
by
Julian
Browse files
Options
Downloads
Patches
Plain Diff
Simplify if-statement
parent
52a293ba
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!360
Resolve "Add absence management to course book student dialog"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/apps/alsijil/models.py
+38
-39
38 additions, 39 deletions
aleksis/apps/alsijil/models.py
with
38 additions
and
39 deletions
aleksis/apps/alsijil/models.py
+
38
−
39
View file @
d2159489
...
...
@@ -10,6 +10,7 @@ from django.db.models.query_utils import Q
from
django.http
import
HttpRequest
from
django.urls
import
reverse
from
django.utils.formats
import
date_format
from
django.utils.timezone
import
localdate
,
localtime
from
django.utils.translation
import
gettext_lazy
as
_
from
django.contrib.auth.models
import
User
...
...
@@ -584,7 +585,7 @@ class Documentation(CalendarEvent):
"""
event_params
=
{
"
type
"
:
"
PARTICIPANT
"
,
"
obj_id
"
:
PERSON_ID
,
"
obj_id
"
:
person
,
}
events
=
LessonEvent
.
get_single_events
(
...
...
@@ -626,9 +627,9 @@ class Documentation(CalendarEvent):
"""
Create a documentation from a lesson_event with start and end datetime.
User is needed for permission checking.
"""
if
user
.
has_perm
(
if
not
user
.
has_perm
(
"
alsijil.add_documentation_for_lesson_event_rule
"
,
lesson_event
)
and
(
)
or
not
(
get_site_preferences
()[
"
alsijil__allow_edit_future_documentations
"
]
==
"
all
"
or
(
get_site_preferences
()[
"
alsijil__allow_edit_future_documentations
"
]
...
...
@@ -641,45 +642,43 @@ class Documentation(CalendarEvent):
and
datetime_start
<=
localtime
()
)
):
if
lesson_event
.
amends
:
if
lesson_event
.
course
:
course
=
lesson_event
.
course
else
:
course
=
lesson_event
.
amends
.
course
raise
PermissionDenied
()
if
lesson_event
.
subject
:
subject
=
lesson_event
.
subject
else
:
subject
=
lesson_event
.
amends
.
subject
if
lesson_event
.
amends
:
if
lesson_event
.
course
:
course
=
lesson_event
.
course
else
:
course
=
lesson_event
.
amends
.
course
if
lesson_event
.
teachers
:
teachers
=
lesson_event
.
teachers
else
:
teachers
=
lesson_event
.
amends
.
teachers
else
:
course
,
subject
,
teachers
=
(
lesson_event
.
course
,
lesson_event
.
subject
,
lesson_event
.
teachers
,
)
if
lesson_event
.
subject
:
subject
=
lesson_event
.
subject
else
:
subject
=
lesson_event
.
amends
.
subject
obj
=
cls
.
objects
.
create
(
datetime_start
=
datetime_start
,
datetime_end
=
datetime_end
,
amends
=
lesson_event
,
course
=
course
,
subject
=
subject
,
topic
=
doc
.
topic
or
""
,
homework
=
doc
.
homework
or
""
,
group_note
=
doc
.
group_note
or
""
,
)
if
doc
.
teachers
is
not
None
:
obj
.
teachers
.
add
(
*
doc
.
teachers
)
else
:
obj
.
teachers
.
set
(
teachers
.
all
())
obj
.
save
()
return
obj
raise
PermissionDenied
()
if
lesson_event
.
teachers
:
teachers
=
lesson_event
.
teachers
else
:
teachers
=
lesson_event
.
amends
.
teachers
else
:
course
,
subject
,
teachers
=
(
lesson_event
.
course
,
lesson_event
.
subject
,
lesson_event
.
teachers
,
)
obj
=
cls
.
objects
.
create
(
datetime_start
=
datetime_start
,
datetime_end
=
datetime_end
,
amends
=
lesson_event
,
course
=
course
,
subject
=
subject
,
topic
=
""
,
homework
=
""
,
group_note
=
""
,
)
obj
.
teachers
.
set
(
teachers
.
all
())
obj
.
save
()
return
obj
class
ParticipationStatus
(
CalendarEvent
):
...
...
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