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
5080ab98
Verified
Commit
5080ab98
authored
7 months ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Create migration checking for old data requiring Lesrooster to be installed
parent
e9d8fa7f
No related branches found
No related tags found
1 merge request
!362
Migration path
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/apps/chronos/migrations/0018_check_new_models.py
+30
-0
30 additions, 0 deletions
aleksis/apps/chronos/migrations/0018_check_new_models.py
with
30 additions
and
0 deletions
aleksis/apps/chronos/migrations/0018_check_new_models.py
0 → 100644
+
30
−
0
View file @
5080ab98
from
django.db
import
migrations
,
models
from
django.apps
import
apps
as
global_apps
def
check_for_migration
(
apps
,
schema_editor
):
if
global_apps
.
is_installed
(
'
aleksis.apps.lesrooster
'
):
return
ValidityRange
=
apps
.
get_model
(
'
chronos
'
,
'
ValidityRange
'
)
Subject
=
apps
.
get_model
(
'
chronos
'
,
'
Subject
'
)
AbsenceReason
=
apps
.
get_model
(
'
chronos
'
,
'
AbsenceReason
'
)
Absence
=
apps
.
get_model
(
'
chronos
'
,
'
Absence
'
)
Holiday
=
apps
.
get_model
(
'
chronos
'
,
'
Holiday
'
)
SupervisionArea
=
apps
.
get_model
(
'
chronos
'
,
'
SupervisionArea
'
)
model_types
=
[
ValidityRange
,
Subject
,
AbsenceReason
,
Absence
,
Holiday
,
SupervisionArea
]
for
model
in
model_types
:
if
model
.
objects
.
exists
():
raise
RuntimeError
(
"
You have legacy data. Please install AlekSIS-App-Lesrooster to migrate them.
"
)
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'
chronos
'
,
'
0017_optional_slot_number
'
),
]
operations
=
[
migrations
.
RunPython
(
check_for_migration
),
]
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