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
Merge requests
!82
Save not only week, but year for week-related stuff
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Save not only week, but year for week-related stuff
chronos-91
into
master
Overview
0
Commits
1
Pipelines
1
Changes
4
Merged
Jonathan Weth
requested to merge
chronos-91
into
master
4 years ago
Overview
0
Commits
1
Pipelines
1
Changes
4
Expand
Blocked by
AlekSIS-App-Chronos!80 (merged)
Edited
4 years ago
by
Jonathan Weth
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
5739d43b
1 commit,
4 years ago
4 files
+
107
−
22
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
Search (e.g. *.vue) (Ctrl+P)
aleksis/apps/alsijil/migrations/0007_personal_note_lesson_documentation_year.py
0 → 100644
+
55
−
0
Options
# Generated by Django 3.0.9 on 2020-08-15 09:39
from
django.db
import
migrations
,
models
import
aleksis.apps.chronos.util.date
def
migrate_data
(
apps
,
schema_editor
):
PersonalNote
=
apps
.
get_model
(
"
alsijil
"
,
"
PersonalNote
"
)
LessonDocumentation
=
apps
.
get_model
(
"
alsijil
"
,
"
LessonDocumentation
"
)
db_alias
=
schema_editor
.
connection
.
alias
for
note
in
PersonalNote
.
objects
.
using
(
db_alias
).
all
():
year
=
note
.
lesson_period
.
lesson
.
validity
.
date_start
.
year
if
note
.
week
<
int
(
note
.
lesson_period
.
lesson
.
validity
.
date_start
.
strftime
(
"
%V
"
)
):
year
+=
1
note
.
year
=
year
note
.
save
()
for
doc
in
LessonDocumentation
.
objects
.
using
(
db_alias
).
all
():
year
=
doc
.
lesson_period
.
lesson
.
validity
.
date_start
.
year
if
doc
.
week
<
int
(
doc
.
lesson_period
.
lesson
.
validity
.
date_start
.
strftime
(
"
%V
"
)):
year
+=
1
doc
.
year
=
year
doc
.
save
()
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
"
alsijil
"
,
"
0006_delete_personal_notes_filter
"
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
"
lessondocumentation
"
,
name
=
"
year
"
,
field
=
models
.
IntegerField
(
default
=
aleksis
.
apps
.
chronos
.
util
.
date
.
get_current_year
,
verbose_name
=
"
Year
"
,
),
),
migrations
.
AddField
(
model_name
=
"
personalnote
"
,
name
=
"
year
"
,
field
=
models
.
IntegerField
(
default
=
aleksis
.
apps
.
chronos
.
util
.
date
.
get_current_year
,
verbose_name
=
"
Year
"
,
),
),
migrations
.
RunPython
(
migrate_data
),
]
Loading