Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
veripeditus-server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Veripeditus
veripeditus-server
Commits
f62edf7f
Commit
f62edf7f
authored
7 years ago
by
Eike Jesinghaus
Browse files
Options
Downloads
Patches
Plain Diff
Add onupdate function to Game.enabled, advances
#115
.
parent
1625ef30
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
veripeditus/server/model.py
+9
-1
9 additions, 1 deletion
veripeditus/server/model.py
with
9 additions
and
1 deletion
veripeditus/server/model.py
+
9
−
1
View file @
f62edf7f
...
...
@@ -109,7 +109,7 @@ class Game(Base):
author
=
DB
.
Column
(
DB
.
String
(
256
))
license
=
DB
.
Column
(
DB
.
String
(
256
))
enabled
=
DB
.
Column
(
DB
.
Boolean
(),
default
=
True
,
nullable
=
False
)
enabled
=
DB
.
Column
(
DB
.
Boolean
(),
default
=
True
,
nullable
=
False
,
onupdate
=
update_enabled
)
# The triple package,name,version needs to be unique
__table_args__
=
(
DB
.
UniqueConstraint
(
'
package
'
,
'
name
'
,
'
version
'
,
...
...
@@ -146,6 +146,14 @@ class Game(Base):
# Redirect to new World object
return
redirect
(
"
/api/world/%i
"
%
world
.
id
)
def
update_enabled
(
context
):
value
=
context
.
current_parameters
[
"
enabled
"
]
if
not
value
:
for
world
in
World
.
query
.
all
():
if
world
.
game
==
self
:
world
.
enabled
=
False
return
value
class
World
(
Base
):
"""
A gaming world with a specific game.
...
...
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