SciPost Code Repository
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SciPost
Manage
Activity
Members
Labels
Plan
Issues
118
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SciPost
SciPost
Commits
317be6f2
Commit
317be6f2
authored
7 years ago
by
Jorran de Wit
Browse files
Options
Downloads
Patches
Plain Diff
Improve journals migration scripts
parent
500cec2e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
journals/migrations/0013_auto_20170407_0954.py
+25
-7
25 additions, 7 deletions
journals/migrations/0013_auto_20170407_0954.py
journals/migrations/0014_journal_active.py
+1
-1
1 addition, 1 deletion
journals/migrations/0014_journal_active.py
with
26 additions
and
8 deletions
journals/migrations/0013_auto_20170407_0954.py
+
25
−
7
View file @
317be6f2
...
...
@@ -10,37 +10,55 @@ def auto_remove_scipost_physics_proc(apps, schema_editor):
try
:
journal
=
Journal
.
objects
.
get
(
name
=
'
SciPostPhysProc
'
)
journal
.
delete
()
print
(
'
\n
...
SciPost Physics Proceedings deleted.
'
)
print
(
'
\n
-
SciPost Physics Proceedings deleted.
..
'
)
except
Journal
.
DoesNotExist
:
print
(
'
\n
...
No SciPost Physics Proceedings does not exist.
'
)
print
(
'
-
No SciPost Physics Proceedings does not exist.
..
'
)
def
auto_add_scipost_physics_proc
(
apps
,
schema_editor
):
Journal
=
apps
.
get_model
(
'
journals
'
,
'
Journal
'
)
Journal
.
objects
.
create
(
name
=
'
SciPostPhysProc
'
,
doi_string
=
'
SciPostPhysProc
'
)
print
(
'
\n
...
SciPost Physics Proceedings created.
'
)
print
(
'
-
SciPost Physics Proceedings created.
..
'
)
def
alter_existing_journal_name
(
apps
,
schema_editor
):
Journal
=
apps
.
get_model
(
'
journals
'
,
'
Journal
'
)
Submission
=
apps
.
get_model
(
'
submissions
'
,
'
Submission
'
)
try
:
journal
=
Journal
.
objects
.
get
(
name
=
'
SciPost Physics
'
)
journal
.
name
=
'
SciPostPhys
'
journal
.
save
()
print
(
'
\n
...SciPost Physics name updated.
'
)
print
(
'
\n
- SciPost Physics name updated...
'
)
Submission
.
objects
.
filter
(
submitted_to_journal
=
'
SciPost Physics
'
).
update
(
submitted_to_journal
=
'
SciPostPhys
'
)
Submission
.
objects
.
filter
(
submitted_to_journal
=
'
SciPost Physics Lecture Notes
'
).
update
(
submitted_to_journal
=
'
SciPostPhysLectNotes
'
)
print
(
'
- Submission `submitted_to_journal` keys updated...
'
)
except
Journal
.
DoesNotExist
:
print
(
'
\n
...
No Journal Names altered.
'
)
print
(
'
-
No Journal Names altered.
..
'
)
def
reverse_alter_existing_journal_name
(
apps
,
schema_editor
):
Journal
=
apps
.
get_model
(
'
journals
'
,
'
Journal
'
)
Submission
=
apps
.
get_model
(
'
submissions
'
,
'
Submission
'
)
try
:
journal
=
Journal
.
objects
.
get
(
name
=
'
SciPostPhys
'
)
journal
.
name
=
'
SciPost Physics
'
journal
.
save
()
print
(
'
\n
...SciPost Physics name updated.
'
)
print
(
'
- SciPost Physics name updated...
'
)
Submission
.
objects
.
filter
(
submitted_to_journal
=
'
SciPostPhys
'
).
update
(
submitted_to_journal
=
'
SciPost Physics
'
)
Submission
.
objects
.
filter
(
submitted_to_journal
=
'
SciPostPhysLectNotes
'
).
update
(
submitted_to_journal
=
'
SciPost Physics Lecture Notes
'
)
print
(
'
- Submission `submitted_to_journal` keys updated...
'
)
except
Journal
.
DoesNotExist
:
print
(
'
\n
...
No Journal Names altered.
'
)
print
(
'
-
No Journal Names altered.
..
'
)
class
Migration
(
migrations
.
Migration
):
...
...
This diff is collapsed.
Click to expand it.
journals/migrations/0014_journal_active.py
+
1
−
1
View file @
317be6f2
...
...
@@ -15,7 +15,7 @@ def auto_deactivate_scipost_physics_proc(apps, schema_editor):
journal
=
Journal
.
objects
.
get
(
name
=
'
SciPostPhysProc
'
,
doi_string
=
'
SciPostPhysProc
'
)
journal
.
active
=
False
journal
.
save
()
print
(
'
\n
...
SciPost Physics Proceedings deactivated.
'
)
print
(
'
\n
-
SciPost Physics Proceedings deactivated.
..
'
)
except
Journal
.
DoesNotExist
:
pass
...
...
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