Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
hackinscience
hkis-website
Commits
7a19ada1
Commit
7a19ada1
authored
Jan 18, 2019
by
Julien Palard
Browse files
Exercise: Add is_published.
parent
c68be42a
Changes
3
Hide whitespace changes
Inline
Side-by-side
website/migrations/0007_exercise_is_published.py
0 → 100644
View file @
7a19ada1
# Generated by Django 2.1 on 2019-01-18 21:43
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[(
"website"
,
"0006_exercise_slug"
)]
operations
=
[
migrations
.
AddField
(
model_name
=
"exercise"
,
name
=
"is_published"
,
field
=
models
.
BooleanField
(
default
=
False
),
)
]
website/migrations/0008_auto_20190118_2151.py
0 → 100644
View file @
7a19ada1
# Generated by Django 2.1 on 2019-01-18 21:51
from
django.db
import
migrations
def
publish_existing
(
apps
,
schema_editor
):
Exercise
=
apps
.
get_model
(
"website"
,
"Exercise"
)
for
exercise
in
Exercise
.
objects
.
all
():
exercise
.
is_published
=
True
exercise
.
save
()
class
Migration
(
migrations
.
Migration
):
dependencies
=
[(
"website"
,
"0007_exercise_is_published"
)]
operations
=
[
migrations
.
RunPython
(
publish_existing
)]
website/models.py
View file @
7a19ada1
...
...
@@ -16,6 +16,7 @@ class Exercise(models.Model):
title
=
models
.
CharField
(
max_length
=
255
)
slug
=
AutoSlugField
(
populate_from
=
[
"title"
],
editable
=
True
)
check
=
models
.
TextField
()
is_published
=
models
.
BooleanField
(
default
=
False
)
solution
=
models
.
TextField
()
wording
=
models
.
TextField
()
initial_solution
=
models
.
TextField
(
default
=
"#!/usr/bin/env python3
\n\n
"
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment