예제 #1
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [("exams", "__first__"), ("kolibriauth", "0001_initial")]

    operations = [
        migrations.CreateModel(
            name="AttemptLog",
            fields=[
                (
                    "id",
                    morango.models.UUIDField(editable=False,
                                             primary_key=True,
                                             serialize=False),
                ),
                (
                    "_morango_dirty_bit",
                    models.BooleanField(default=True, editable=False),
                ),
                ("_morango_source_id",
                 models.CharField(editable=False, max_length=96)),
                (
                    "_morango_partition",
                    models.CharField(editable=False, max_length=128),
                ),
                ("item", models.CharField(max_length=200)),
                ("start_timestamp", models.DateTimeField()),
                ("end_timestamp", models.DateTimeField()),
                ("completion_timestamp",
                 models.DateTimeField(blank=True, null=True)),
                (
                    "time_spent",
                    models.FloatField(
                        default=0.0,
                        help_text="(in seconds)",
                        validators=[
                            django.core.validators.MinValueValidator(0)
                        ],
                    ),
                ),
                ("complete", models.BooleanField(default=False)),
                (
                    "correct",
                    models.FloatField(validators=[
                        django.core.validators.MinValueValidator(0),
                        django.core.validators.MaxValueValidator(1),
                    ]),
                ),
                ("hinted", models.BooleanField(default=False)),
                (
                    "answer",
                    jsonfield.fields.JSONField(blank=True,
                                               default={},
                                               null=True),
                ),
                ("simple_answer", models.CharField(blank=True,
                                                   max_length=200)),
                (
                    "interaction_history",
                    jsonfield.fields.JSONField(blank=True, default=[]),
                ),
                (
                    "dataset",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="kolibriauth.FacilityDataset",
                    ),
                ),
            ],
            options={"abstract": False},
        ),
        migrations.CreateModel(
            name="ContentSessionLog",
            fields=[
                (
                    "id",
                    morango.models.UUIDField(editable=False,
                                             primary_key=True,
                                             serialize=False),
                ),
                (
                    "_morango_dirty_bit",
                    models.BooleanField(default=True, editable=False),
                ),
                ("_morango_source_id",
                 models.CharField(editable=False, max_length=96)),
                (
                    "_morango_partition",
                    models.CharField(editable=False, max_length=128),
                ),
                ("content_id", morango.models.UUIDField(db_index=True)),
                ("channel_id", morango.models.UUIDField()),
                ("start_timestamp", models.DateTimeField()),
                ("end_timestamp", models.DateTimeField(blank=True, null=True)),
                (
                    "time_spent",
                    models.FloatField(
                        default=0.0,
                        help_text="(in seconds)",
                        validators=[
                            django.core.validators.MinValueValidator(0)
                        ],
                    ),
                ),
                (
                    "progress",
                    models.FloatField(
                        default=0,
                        validators=[
                            django.core.validators.MinValueValidator(0)
                        ],
                    ),
                ),
                ("kind", models.CharField(max_length=200)),
                ("extra_fields",
                 jsonfield.fields.JSONField(blank=True, default={})),
                (
                    "dataset",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="kolibriauth.FacilityDataset",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="kolibriauth.FacilityUser",
                    ),
                ),
            ],
            options={"abstract": False},
        ),
        migrations.CreateModel(
            name="ContentSummaryLog",
            fields=[
                (
                    "id",
                    morango.models.UUIDField(editable=False,
                                             primary_key=True,
                                             serialize=False),
                ),
                (
                    "_morango_dirty_bit",
                    models.BooleanField(default=True, editable=False),
                ),
                ("_morango_source_id",
                 models.CharField(editable=False, max_length=96)),
                (
                    "_morango_partition",
                    models.CharField(editable=False, max_length=128),
                ),
                ("content_id", morango.models.UUIDField(db_index=True)),
                ("channel_id", morango.models.UUIDField()),
                ("start_timestamp", models.DateTimeField()),
                ("end_timestamp", models.DateTimeField(blank=True, null=True)),
                ("completion_timestamp",
                 models.DateTimeField(blank=True, null=True)),
                (
                    "time_spent",
                    models.FloatField(
                        default=0.0,
                        help_text="(in seconds)",
                        validators=[
                            django.core.validators.MinValueValidator(0)
                        ],
                    ),
                ),
                (
                    "progress",
                    models.FloatField(
                        default=0,
                        validators=[
                            django.core.validators.MinValueValidator(0),
                            django.core.validators.MaxValueValidator(1.01),
                        ],
                    ),
                ),
                ("kind", models.CharField(max_length=200)),
                ("extra_fields",
                 jsonfield.fields.JSONField(blank=True, default={})),
                (
                    "dataset",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="kolibriauth.FacilityDataset",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="kolibriauth.FacilityUser",
                    ),
                ),
            ],
            options={"abstract": False},
        ),
        migrations.CreateModel(
            name="ExamAttemptLog",
            fields=[
                (
                    "id",
                    morango.models.UUIDField(editable=False,
                                             primary_key=True,
                                             serialize=False),
                ),
                (
                    "_morango_dirty_bit",
                    models.BooleanField(default=True, editable=False),
                ),
                ("_morango_source_id",
                 models.CharField(editable=False, max_length=96)),
                (
                    "_morango_partition",
                    models.CharField(editable=False, max_length=128),
                ),
                ("item", models.CharField(max_length=200)),
                ("start_timestamp", models.DateTimeField()),
                ("end_timestamp", models.DateTimeField()),
                ("completion_timestamp",
                 models.DateTimeField(blank=True, null=True)),
                (
                    "time_spent",
                    models.FloatField(
                        default=0.0,
                        help_text="(in seconds)",
                        validators=[
                            django.core.validators.MinValueValidator(0)
                        ],
                    ),
                ),
                ("complete", models.BooleanField(default=False)),
                (
                    "correct",
                    models.FloatField(validators=[
                        django.core.validators.MinValueValidator(0),
                        django.core.validators.MaxValueValidator(1),
                    ]),
                ),
                ("hinted", models.BooleanField(default=False)),
                (
                    "answer",
                    jsonfield.fields.JSONField(blank=True,
                                               default={},
                                               null=True),
                ),
                ("simple_answer", models.CharField(blank=True,
                                                   max_length=200)),
                (
                    "interaction_history",
                    jsonfield.fields.JSONField(blank=True, default=[]),
                ),
                ("content_id", morango.models.UUIDField()),
                ("channel_id", morango.models.UUIDField()),
                (
                    "dataset",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="kolibriauth.FacilityDataset",
                    ),
                ),
            ],
            options={"abstract": False},
        ),
        migrations.CreateModel(
            name="ExamLog",
            fields=[
                (
                    "id",
                    morango.models.UUIDField(editable=False,
                                             primary_key=True,
                                             serialize=False),
                ),
                (
                    "_morango_dirty_bit",
                    models.BooleanField(default=True, editable=False),
                ),
                ("_morango_source_id",
                 models.CharField(editable=False, max_length=96)),
                (
                    "_morango_partition",
                    models.CharField(editable=False, max_length=128),
                ),
                ("closed", models.BooleanField(default=False)),
                ("completion_timestamp",
                 models.DateTimeField(blank=True, null=True)),
                (
                    "dataset",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="kolibriauth.FacilityDataset",
                    ),
                ),
                (
                    "exam",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="examlogs",
                        to="exams.Exam",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="kolibriauth.FacilityUser",
                    ),
                ),
            ],
            options={"abstract": False},
        ),
        migrations.CreateModel(
            name="MasteryLog",
            fields=[
                (
                    "id",
                    morango.models.UUIDField(editable=False,
                                             primary_key=True,
                                             serialize=False),
                ),
                (
                    "_morango_dirty_bit",
                    models.BooleanField(default=True, editable=False),
                ),
                ("_morango_source_id",
                 models.CharField(editable=False, max_length=96)),
                (
                    "_morango_partition",
                    models.CharField(editable=False, max_length=128),
                ),
                ("mastery_criterion", jsonfield.fields.JSONField(default={})),
                ("start_timestamp", models.DateTimeField()),
                ("end_timestamp", models.DateTimeField(blank=True, null=True)),
                ("completion_timestamp",
                 models.DateTimeField(blank=True, null=True)),
                (
                    "mastery_level",
                    models.IntegerField(validators=[
                        django.core.validators.MinValueValidator(1),
                        django.core.validators.MaxValueValidator(10),
                    ]),
                ),
                ("complete", models.BooleanField(default=False)),
                (
                    "dataset",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="kolibriauth.FacilityDataset",
                    ),
                ),
                (
                    "summarylog",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="masterylogs",
                        to="logger.ContentSummaryLog",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="kolibriauth.FacilityUser",
                    ),
                ),
            ],
            options={"abstract": False},
        ),
        migrations.CreateModel(
            name="UserSessionLog",
            fields=[
                (
                    "id",
                    morango.models.UUIDField(editable=False,
                                             primary_key=True,
                                             serialize=False),
                ),
                (
                    "_morango_dirty_bit",
                    models.BooleanField(default=True, editable=False),
                ),
                ("_morango_source_id",
                 models.CharField(editable=False, max_length=96)),
                (
                    "_morango_partition",
                    models.CharField(editable=False, max_length=128),
                ),
                ("channels", models.TextField(blank=True)),
                ("start_timestamp", models.DateTimeField(auto_now_add=True)),
                (
                    "last_interaction_timestamp",
                    models.DateTimeField(auto_now=True, null=True),
                ),
                ("pages", models.TextField(blank=True)),
                (
                    "dataset",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="kolibriauth.FacilityDataset",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="kolibriauth.FacilityUser",
                    ),
                ),
            ],
            options={"abstract": False},
        ),
        migrations.AddField(
            model_name="examattemptlog",
            name="examlog",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="attemptlogs",
                to="logger.ExamLog",
            ),
        ),
        migrations.AddField(
            model_name="examattemptlog",
            name="user",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to="kolibriauth.FacilityUser",
            ),
        ),
        migrations.AddField(
            model_name="attemptlog",
            name="masterylog",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="attemptlogs",
                to="logger.MasteryLog",
            ),
        ),
        migrations.AddField(
            model_name="attemptlog",
            name="sessionlog",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="attemptlogs",
                to="logger.ContentSessionLog",
            ),
        ),
        migrations.AddField(
            model_name="attemptlog",
            name="user",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to="kolibriauth.FacilityUser",
            ),
        ),
    ]
예제 #2
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [("kolibriauth", "0007_auto_20171226_1125")]

    operations = [
        migrations.CreateModel(
            name="Lesson",
            fields=[
                (
                    "id",
                    morango.models.UUIDField(editable=False,
                                             primary_key=True,
                                             serialize=False),
                ),
                (
                    "_morango_dirty_bit",
                    models.BooleanField(default=True, editable=False),
                ),
                ("_morango_source_id",
                 models.CharField(editable=False, max_length=96)),
                (
                    "_morango_partition",
                    models.CharField(editable=False, max_length=128),
                ),
                ("name", models.CharField(max_length=50)),
                (
                    "description",
                    models.CharField(blank=True, default="", max_length=200),
                ),
                ("resources", jsonfield.fields.JSONField(blank=True,
                                                         default=[])),
                ("is_active", models.BooleanField(default=False)),
                ("is_archived", models.BooleanField(default=False)),
                (
                    "collection",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="lessons",
                        to="kolibriauth.Collection",
                    ),
                ),
                (
                    "created_by",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="lessons_created",
                        to="kolibriauth.FacilityUser",
                    ),
                ),
                (
                    "dataset",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="kolibriauth.FacilityDataset",
                    ),
                ),
            ],
            options={"abstract": False},
        ),
        migrations.CreateModel(
            name="LessonAssignment",
            fields=[
                (
                    "id",
                    morango.models.UUIDField(editable=False,
                                             primary_key=True,
                                             serialize=False),
                ),
                (
                    "_morango_dirty_bit",
                    models.BooleanField(default=True, editable=False),
                ),
                ("_morango_source_id",
                 models.CharField(editable=False, max_length=96)),
                (
                    "_morango_partition",
                    models.CharField(editable=False, max_length=128),
                ),
                (
                    "assigned_by",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="assigned_lessons",
                        to="kolibriauth.FacilityUser",
                    ),
                ),
                (
                    "collection",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="assigned_lessons",
                        to="kolibriauth.Collection",
                    ),
                ),
                (
                    "dataset",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="kolibriauth.FacilityDataset",
                    ),
                ),
                (
                    "lesson",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="assigned_groups",
                        to="lessons.Lesson",
                    ),
                ),
            ],
            options={"abstract": False},
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [("content", "0003_auto_20170607_1212")]

    operations = [
        migrations.CreateModel(
            name="AssessmentMetaData",
            fields=[
                ("id",
                 morango.models.UUIDField(primary_key=True, serialize=False)),
                ("assessment_item_ids",
                 kolibri.core.fields.JSONField(default=[])),
                ("number_of_assessments", models.IntegerField()),
                ("mastery_model", kolibri.core.fields.JSONField(default={})),
                ("randomize", models.BooleanField(default=False)),
                ("is_manipulable", models.BooleanField(default=False)),
            ],
        ),
        migrations.CreateModel(
            name="ChannelMetadata",
            fields=[
                ("id",
                 morango.models.UUIDField(primary_key=True, serialize=False)),
                ("name", models.CharField(max_length=200)),
                ("description", models.CharField(blank=True, max_length=400)),
                ("author", models.CharField(blank=True, max_length=400)),
                ("version", models.IntegerField(default=0)),
                ("thumbnail", models.TextField(blank=True)),
                ("last_updated",
                 kolibri.core.fields.DateTimeTzField(null=True)),
                ("min_schema_version", models.CharField(max_length=50)),
            ],
        ),
        migrations.CreateModel(
            name="ContentNode",
            fields=[
                ("id",
                 morango.models.UUIDField(primary_key=True, serialize=False)),
                ("title", models.CharField(max_length=200)),
                ("content_id", morango.models.UUIDField(db_index=True)),
                ("channel_id", morango.models.UUIDField(db_index=True)),
                (
                    "description",
                    models.CharField(blank=True, max_length=400, null=True),
                ),
                ("sort_order", models.FloatField(blank=True, null=True)),
                ("license_owner", models.CharField(blank=True,
                                                   max_length=200)),
                ("author", models.CharField(blank=True, max_length=200)),
                (
                    "kind",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("topic", "Topic"),
                            ("video", "Video"),
                            ("audio", "Audio"),
                            ("exercise", "Exercise"),
                            ("document", "Document"),
                            ("html5", "HTML5 App"),
                        ],
                        max_length=200,
                    ),
                ),
                ("available", models.BooleanField(default=False)),
                ("stemmed_metaphone",
                 models.CharField(blank=True, max_length=1800)),
                ("lft",
                 models.PositiveIntegerField(db_index=True, editable=False)),
                ("rght",
                 models.PositiveIntegerField(db_index=True, editable=False)),
                ("tree_id",
                 models.PositiveIntegerField(db_index=True, editable=False)),
                ("level",
                 models.PositiveIntegerField(db_index=True, editable=False)),
                (
                    "has_prerequisite",
                    models.ManyToManyField(
                        blank=True,
                        related_name="prerequisite_for",
                        to="content.ContentNode",
                    ),
                ),
            ],
            options={"ordering": ("lft", )},
            # Removed because django-mptt 0.8.7 patched up an error in
            # Django 1.9 (fixed since 1.10).
            # Ref: https://code.djangoproject.com/ticket/26643
            # https://github.com/learningequality/kolibri/pull/3180
            # managers=[
            #     ('_default_manager', django.db.models.manager.Manager()),
            # ],
            # Removed with the same reasoning
            # managers=[
            #     ('objects', django.db.models.manager.Manager()),
            # ],
        ),
        migrations.CreateModel(
            name="ContentTag",
            fields=[
                ("id",
                 morango.models.UUIDField(primary_key=True, serialize=False)),
                ("tag_name", models.CharField(blank=True, max_length=30)),
            ],
        ),
        migrations.CreateModel(
            name="File",
            fields=[
                ("id",
                 morango.models.UUIDField(primary_key=True, serialize=False)),
                ("available", models.BooleanField(default=False)),
                (
                    "preset",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("high_res_video", "High Resolution"),
                            ("low_res_video", "Low Resolution"),
                            ("vector_video", "Vectorized"),
                            ("video_thumbnail", "Thumbnail"),
                            ("video_subtitle", "Subtitle"),
                            ("audio", "Audio"),
                            ("audio_thumbnail", "Thumbnail"),
                            ("document", "Document"),
                            ("document_thumbnail", "Thumbnail"),
                            ("exercise", "Exercise"),
                            ("exercise_thumbnail", "Thumbnail"),
                            ("exercise_image", "Exercise Image"),
                            ("exercise_graphie", "Exercise Graphie"),
                            ("channel_thumbnail", "Channel Thumbnail"),
                            ("topic_thumbnail", "Thumbnail"),
                            ("html5_zip", "HTML5 Zip"),
                            ("html5_thumbnail", "HTML5 Thumbnail"),
                        ],
                        max_length=150,
                    ),
                ),
                ("supplementary", models.BooleanField(default=False)),
                ("thumbnail", models.BooleanField(default=False)),
                ("priority",
                 models.IntegerField(blank=True, db_index=True, null=True)),
                (
                    "contentnode",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="files",
                        to="content.ContentNode",
                    ),
                ),
            ],
            options={"ordering": ["priority"]},
        ),
        migrations.CreateModel(
            name="Language",
            fields=[
                (
                    "id",
                    models.CharField(max_length=14,
                                     primary_key=True,
                                     serialize=False),
                ),
                ("lang_code", models.CharField(db_index=True, max_length=3)),
                (
                    "lang_subcode",
                    models.CharField(blank=True,
                                     db_index=True,
                                     max_length=10,
                                     null=True),
                ),
                ("lang_name",
                 models.CharField(blank=True, max_length=100, null=True)),
                (
                    "lang_direction",
                    models.CharField(
                        choices=[("ltr", "Left to Right"),
                                 ("rtl", "Right to Left")],
                        default="ltr",
                        max_length=3,
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="License",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("license_name", models.CharField(max_length=50)),
                (
                    "license_description",
                    models.CharField(blank=True, max_length=400, null=True),
                ),
            ],
        ),
        migrations.CreateModel(
            name="LocalFile",
            fields=[
                (
                    "id",
                    models.CharField(max_length=32,
                                     primary_key=True,
                                     serialize=False),
                ),
                (
                    "extension",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("mp4", "MP4 Video"),
                            ("vtt", "VTT Subtitle"),
                            ("srt", "SRT Subtitle"),
                            ("mp3", "MP3 Audio"),
                            ("pdf", "PDF Document"),
                            ("jpg", "JPG Image"),
                            ("jpeg", "JPEG Image"),
                            ("png", "PNG Image"),
                            ("gif", "GIF Image"),
                            ("json", "JSON"),
                            ("svg", "SVG Image"),
                            ("perseus", "Perseus Exercise"),
                            ("zip", "HTML5 Zip"),
                        ],
                        max_length=40,
                    ),
                ),
                ("available", models.BooleanField(default=False)),
                ("file_size", models.IntegerField(blank=True, null=True)),
            ],
        ),
        migrations.DeleteModel(name="ChannelMetadataCache"),
        migrations.AddField(
            model_name="file",
            name="lang",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to="content.Language",
            ),
        ),
        migrations.AddField(
            model_name="file",
            name="local_file",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="files",
                to="content.LocalFile",
            ),
        ),
        migrations.AddField(
            model_name="contentnode",
            name="lang",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to="content.Language",
            ),
        ),
        migrations.AddField(
            model_name="contentnode",
            name="license",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to="content.License",
            ),
        ),
        migrations.AddField(
            model_name="contentnode",
            name="parent",
            field=mptt.fields.TreeForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="children",
                to="content.ContentNode",
            ),
        ),
        migrations.AddField(
            model_name="contentnode",
            name="related",
            field=models.ManyToManyField(
                blank=True,
                related_name="_contentnode_related_+",
                to="content.ContentNode",
            ),
        ),
        migrations.AddField(
            model_name="contentnode",
            name="tags",
            field=models.ManyToManyField(blank=True,
                                         related_name="tagged_content",
                                         to="content.ContentTag"),
        ),
        migrations.AddField(
            model_name="channelmetadata",
            name="root",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to="content.ContentNode"),
        ),
        migrations.AddField(
            model_name="assessmentmetadata",
            name="contentnode",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="assessmentmetadata",
                to="content.ContentNode",
            ),
        ),
    ]
예제 #4
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [("kolibriauth", "0001_initial")]

    operations = [
        migrations.CreateModel(
            name="Exam",
            fields=[
                (
                    "id",
                    morango.models.UUIDField(
                        editable=False, primary_key=True, serialize=False
                    ),
                ),
                (
                    "_morango_dirty_bit",
                    models.BooleanField(default=True, editable=False),
                ),
                ("_morango_source_id", models.CharField(editable=False, max_length=96)),
                (
                    "_morango_partition",
                    models.CharField(editable=False, max_length=128),
                ),
                ("title", models.CharField(max_length=200)),
                ("channel_id", models.CharField(max_length=32, blank=True)),
                ("question_count", models.IntegerField()),
                (
                    "question_sources",
                    kolibri.core.fields.JSONField(blank=True, default=[]),
                ),
                ("seed", models.IntegerField(default=1)),
                ("active", models.BooleanField(default=False)),
                ("archive", models.BooleanField(default=False)),
                (
                    "collection",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="exams",
                        to="kolibriauth.Collection",
                    ),
                ),
                (
                    "creator",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="exams",
                        to="kolibriauth.FacilityUser",
                    ),
                ),
                (
                    "dataset",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="kolibriauth.FacilityDataset",
                    ),
                ),
            ],
            options={"abstract": False},
        ),
        migrations.CreateModel(
            name="ExamAssignment",
            fields=[
                (
                    "id",
                    morango.models.UUIDField(
                        editable=False, primary_key=True, serialize=False
                    ),
                ),
                (
                    "_morango_dirty_bit",
                    models.BooleanField(default=True, editable=False),
                ),
                ("_morango_source_id", models.CharField(editable=False, max_length=96)),
                (
                    "_morango_partition",
                    models.CharField(editable=False, max_length=128),
                ),
                (
                    "assigned_by",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="assigned_exams",
                        to="kolibriauth.FacilityUser",
                    ),
                ),
                (
                    "collection",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="assigned_exams",
                        to="kolibriauth.Collection",
                    ),
                ),
                (
                    "dataset",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="kolibriauth.FacilityDataset",
                    ),
                ),
                (
                    "exam",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="assignments",
                        to="exams.Exam",
                    ),
                ),
            ],
            options={"abstract": False},
        ),
    ]
예제 #5
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="DeviceOwner",
            fields=[
                ("password", models.CharField(max_length=128, verbose_name="password")),
                (
                    "last_login",
                    models.DateTimeField(
                        blank=True, null=True, verbose_name="last login"
                    ),
                ),
                (
                    "username",
                    models.CharField(
                        help_text="Required. 30 characters or fewer. Letters and digits only",
                        max_length=30,
                        validators=[
                            django.core.validators.RegexValidator(
                                "^\\w+$",
                                "Enter a valid username. This value may contain only letters and numbers.",
                            )
                        ],
                        verbose_name="username",
                    ),
                ),
                (
                    "full_name",
                    models.CharField(
                        blank=True, max_length=120, verbose_name="full name"
                    ),
                ),
                (
                    "date_joined",
                    models.DateTimeField(
                        default=django.utils.timezone.now,
                        editable=False,
                        verbose_name="date joined",
                    ),
                ),
                (
                    "id",
                    morango.models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
            ],
            options={"abstract": False},
        ),
        migrations.CreateModel(
            name="Collection",
            fields=[
                (
                    "id",
                    morango.models.UUIDField(
                        editable=False, primary_key=True, serialize=False
                    ),
                ),
                (
                    "_morango_dirty_bit",
                    models.BooleanField(default=True, editable=False),
                ),
                ("_morango_source_id", models.CharField(editable=False, max_length=96)),
                (
                    "_morango_partition",
                    models.CharField(editable=False, max_length=128),
                ),
                ("name", models.CharField(max_length=100)),
                (
                    "kind",
                    models.CharField(
                        choices=[
                            (b"facility", "Facility"),
                            (b"classroom", "Classroom"),
                            (b"learnergroup", "Learner group"),
                        ],
                        max_length=20,
                    ),
                ),
                ("lft", models.PositiveIntegerField(db_index=True, editable=False)),
                ("rght", models.PositiveIntegerField(db_index=True, editable=False)),
                ("tree_id", models.PositiveIntegerField(db_index=True, editable=False)),
                ("level", models.PositiveIntegerField(db_index=True, editable=False)),
            ],
            options={"abstract": False},
        ),
        migrations.CreateModel(
            name="FacilityDataset",
            fields=[
                (
                    "id",
                    morango.models.UUIDField(
                        editable=False, primary_key=True, serialize=False
                    ),
                ),
                (
                    "_morango_dirty_bit",
                    models.BooleanField(default=True, editable=False),
                ),
                ("_morango_source_id", models.CharField(editable=False, max_length=96)),
                (
                    "_morango_partition",
                    models.CharField(editable=False, max_length=128),
                ),
                ("description", models.TextField(blank=True)),
                ("location", models.CharField(blank=True, max_length=200)),
                ("learner_can_edit_username", models.BooleanField(default=True)),
                ("learner_can_edit_name", models.BooleanField(default=True)),
                ("learner_can_edit_password", models.BooleanField(default=True)),
                ("learner_can_sign_up", models.BooleanField(default=True)),
                ("learner_can_delete_account", models.BooleanField(default=True)),
            ],
            options={"abstract": False},
        ),
        migrations.CreateModel(
            name="FacilityUser",
            fields=[
                ("password", models.CharField(max_length=128, verbose_name="password")),
                (
                    "last_login",
                    models.DateTimeField(
                        blank=True, null=True, verbose_name="last login"
                    ),
                ),
                (
                    "id",
                    morango.models.UUIDField(
                        editable=False, primary_key=True, serialize=False
                    ),
                ),
                (
                    "_morango_dirty_bit",
                    models.BooleanField(default=True, editable=False),
                ),
                ("_morango_source_id", models.CharField(editable=False, max_length=96)),
                (
                    "_morango_partition",
                    models.CharField(editable=False, max_length=128),
                ),
                (
                    "username",
                    models.CharField(
                        help_text="Required. 30 characters or fewer. Letters and digits only",
                        max_length=30,
                        validators=[
                            django.core.validators.RegexValidator(
                                "^\\w+$",
                                "Enter a valid username. This value may contain only letters and numbers.",
                            )
                        ],
                        verbose_name="username",
                    ),
                ),
                (
                    "full_name",
                    models.CharField(
                        blank=True, max_length=120, verbose_name="full name"
                    ),
                ),
                (
                    "date_joined",
                    models.DateTimeField(
                        default=django.utils.timezone.now,
                        editable=False,
                        verbose_name="date joined",
                    ),
                ),
                (
                    "dataset",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="kolibriauth.FacilityDataset",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Membership",
            fields=[
                (
                    "id",
                    morango.models.UUIDField(
                        editable=False, primary_key=True, serialize=False
                    ),
                ),
                (
                    "_morango_dirty_bit",
                    models.BooleanField(default=True, editable=False),
                ),
                ("_morango_source_id", models.CharField(editable=False, max_length=96)),
                (
                    "_morango_partition",
                    models.CharField(editable=False, max_length=128),
                ),
                (
                    "collection",
                    mptt.fields.TreeForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="kolibriauth.Collection",
                    ),
                ),
                (
                    "dataset",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="kolibriauth.FacilityDataset",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="kolibriauth.FacilityUser",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Role",
            fields=[
                (
                    "id",
                    morango.models.UUIDField(
                        editable=False, primary_key=True, serialize=False
                    ),
                ),
                (
                    "_morango_dirty_bit",
                    models.BooleanField(default=True, editable=False),
                ),
                ("_morango_source_id", models.CharField(editable=False, max_length=96)),
                (
                    "_morango_partition",
                    models.CharField(editable=False, max_length=128),
                ),
                (
                    "kind",
                    models.CharField(
                        choices=[(b"admin", "Admin"), (b"coach", "Coach")],
                        max_length=20,
                    ),
                ),
                (
                    "collection",
                    mptt.fields.TreeForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="kolibriauth.Collection",
                    ),
                ),
                (
                    "dataset",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="kolibriauth.FacilityDataset",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="roles",
                        to="kolibriauth.FacilityUser",
                    ),
                ),
            ],
        ),
        migrations.AddField(
            model_name="collection",
            name="dataset",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to="kolibriauth.FacilityDataset",
            ),
        ),
        migrations.AddField(
            model_name="collection",
            name="parent",
            field=mptt.fields.TreeForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="children",
                to="kolibriauth.Collection",
            ),
        ),
        migrations.CreateModel(
            name="Classroom",
            fields=[],
            options={"proxy": True},
            bases=("kolibriauth.collection",),
        ),
        migrations.CreateModel(
            name="Facility",
            fields=[],
            options={"proxy": True},
            bases=("kolibriauth.collection",),
        ),
        migrations.CreateModel(
            name="LearnerGroup",
            fields=[],
            options={"proxy": True},
            bases=("kolibriauth.collection",),
        ),
        migrations.AlterUniqueTogether(
            name="role", unique_together=set([("user", "collection", "kind")])
        ),
        migrations.AlterUniqueTogether(
            name="membership", unique_together=set([("user", "collection")])
        ),
        migrations.AddField(
            model_name="facilityuser",
            name="facility",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE, to="kolibriauth.Facility"
            ),
        ),
        migrations.AlterUniqueTogether(
            name="facilityuser", unique_together=set([("username", "facility")])
        ),
    ]