NDOJ/judge/migrations/0148_course_courseassignment_courseresource_courserole.py

188 lines
6.3 KiB
Python
Raw Permalink Normal View History

2023-01-31 15:50:52 +00:00
# Generated by Django 3.2.16 on 2023-01-31 15:49
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
2023-01-31 15:56:16 +00:00
("judge", "0147_alter_profile_timezone"),
2023-01-31 15:50:52 +00:00
]
operations = [
migrations.CreateModel(
2023-01-31 15:56:16 +00:00
name="Course",
2023-01-31 15:50:52 +00:00
fields=[
2023-01-31 15:56:16 +00:00
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=128, verbose_name="course name")),
("about", models.TextField(verbose_name="organization description")),
("ending_time", models.DateTimeField(verbose_name="ending time")),
(
"is_public",
models.BooleanField(default=False, verbose_name="publicly visible"),
),
(
"slug",
models.SlugField(
help_text="Course name shown in URL",
max_length=128,
unique=True,
validators=[
django.core.validators.RegexValidator(
"^[-a-zA-Z0-9]+$", "Only alphanumeric and hyphens"
)
],
verbose_name="course slug",
),
),
(
"is_open",
models.BooleanField(
default=False, verbose_name="public registration"
),
),
(
"image_url",
models.CharField(
blank=True,
default="",
max_length=150,
verbose_name="course image",
),
),
(
"organizations",
models.ManyToManyField(
blank=True,
help_text="If private, only these organizations may see the course",
to="judge.Organization",
verbose_name="organizations",
),
),
2023-01-31 15:50:52 +00:00
],
),
migrations.CreateModel(
2023-01-31 15:56:16 +00:00
name="CourseRole",
2023-01-31 15:50:52 +00:00
fields=[
2023-01-31 15:56:16 +00:00
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"role",
models.CharField(
choices=[
("ST", "Student"),
("AS", "Assistant"),
("TE", "Teacher"),
],
default="ST",
max_length=2,
),
),
(
"course",
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
to="judge.course",
verbose_name="course",
),
),
(
"user",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="user_of_course",
to="judge.profile",
verbose_name="user",
),
),
2023-01-31 15:50:52 +00:00
],
),
migrations.CreateModel(
2023-01-31 15:56:16 +00:00
name="CourseResource",
2023-01-31 15:50:52 +00:00
fields=[
2023-01-31 15:56:16 +00:00
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"files",
models.FileField(
blank=True, null=True, upload_to="", verbose_name="course files"
),
),
(
"description",
models.CharField(
blank=True, max_length=150, verbose_name="description"
),
),
("order", models.IntegerField(default=None, null=True)),
(
"is_public",
models.BooleanField(default=False, verbose_name="publicly visible"),
),
(
"course",
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
to="judge.course",
verbose_name="course",
),
),
2023-01-31 15:50:52 +00:00
],
),
migrations.CreateModel(
2023-01-31 15:56:16 +00:00
name="CourseAssignment",
2023-01-31 15:50:52 +00:00
fields=[
2023-01-31 15:56:16 +00:00
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("points", models.FloatField(verbose_name="points")),
(
"contest",
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
to="judge.contest",
verbose_name="contest",
),
),
(
"course",
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
to="judge.course",
verbose_name="course",
),
),
2023-01-31 15:50:52 +00:00
],
),
2023-01-31 15:56:16 +00:00
]