Commit 7a19ada1 authored by Julien Palard's avatar Julien Palard
Browse files

Exercise: Add is_published.

parent c68be42a
# 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),
)
]
# 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)]
......@@ -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")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment