Add assignment app

This commit is contained in:
Ramon Wenger 2018-09-27 11:47:41 +02:00
parent 65d50f686c
commit 826849f1e0
13 changed files with 139 additions and 2 deletions

View File

View File

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

View File

@ -0,0 +1,5 @@
from django.apps import AppConfig
class StudententryConfig(AppConfig):
name = 'assignments'

View File

@ -0,0 +1,76 @@
# Generated by Django 2.0.6 on 2018-09-27 09:45
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django_extensions.db.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Assignment',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, verbose_name='created')),
('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, verbose_name='modified')),
('title', models.CharField(max_length=255)),
('assignment', models.TextField()),
('deleted', models.BooleanField(default=False)),
],
options={
'ordering': ('-modified', '-created'),
'get_latest_by': 'modified',
'abstract': False,
},
),
migrations.CreateModel(
name='StudentSubmission',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, verbose_name='created')),
('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, verbose_name='modified')),
('text', models.TextField(blank=True)),
('document', models.FilePathField(null=True)),
],
options={
'ordering': ('-modified', '-created'),
'get_latest_by': 'modified',
'abstract': False,
},
),
migrations.CreateModel(
name='CustomAssignment',
fields=[
('assignment_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='assignments.Assignment')),
],
options={
'ordering': ('-modified', '-created'),
'get_latest_by': 'modified',
'abstract': False,
},
bases=('assignments.assignment',),
),
migrations.AddField(
model_name='studentsubmission',
name='assignment',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='assignments.Assignment'),
),
migrations.AddField(
model_name='studentsubmission',
name='student',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='assignment',
name='owner',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL),
),
]

View File

@ -0,0 +1,25 @@
from django.contrib.auth import get_user_model
from django.db import models
from django_extensions.db.models import TimeStampedModel
class Assignment(TimeStampedModel):
title = models.CharField(max_length=255)
assignment = models.TextField()
deleted = models.BooleanField(default=False)
owner = models.ForeignKey(get_user_model(),
on_delete=models.PROTECT) # probably don't want to delete all assignments if a user gets deleted
def __str__(self):
return self.title
class CustomAssignment(Assignment):
pass
class StudentSubmission(TimeStampedModel):
text = models.TextField(blank=True)
document = models.FilePathField(null=True)
assignment = models.ForeignKey(Assignment, on_delete=models.CASCADE)
student = models.ForeignKey(get_user_model(), on_delete=models.CASCADE)

View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

View File

@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.

View File

@ -0,0 +1,21 @@
# Generated by Django 2.0.6 on 2018-09-27 09:45
from django.db import migrations
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.images.blocks
class Migration(migrations.Migration):
dependencies = [
('book', '0003_auto_20180918_1605'),
]
operations = [
migrations.AlterField(
model_name='contentblock',
name='contents',
field=wagtail.core.fields.StreamField([('text_block', wagtail.core.blocks.StructBlock([('text', wagtail.core.blocks.RichTextBlock())])), ('basic_knowledge', wagtail.core.blocks.StructBlock([('description', wagtail.core.blocks.RichTextBlock()), ('url', wagtail.core.blocks.URLBlock())])), ('student_entry', wagtail.core.blocks.StructBlock([('task_text', wagtail.core.blocks.RichTextBlock())])), ('image_block', wagtail.images.blocks.ImageChooserBlock()), ('image_url_block', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.RichTextBlock()), ('url', wagtail.core.blocks.URLBlock())])), ('link_block', wagtail.core.blocks.StructBlock([('text', wagtail.core.blocks.TextBlock()), ('url', wagtail.core.blocks.URLBlock())])), ('task', wagtail.core.blocks.StructBlock([('text', wagtail.core.blocks.RichTextBlock())], icon='tick')), ('video_block', wagtail.core.blocks.StructBlock([('url', wagtail.core.blocks.URLBlock())])), ('document_block', wagtail.core.blocks.StructBlock([('url', wagtail.core.blocks.URLBlock())]))], blank=True, null=True),
),
]

View File

@ -5,7 +5,7 @@ from graphene import InputObjectType
class InputTypes(graphene.Enum):
text_block = 'text_block'
# basic_knowledge = 'basic_knowledge' # probably won't be using this over the API
student_entry = 'student_entry'
assignment = 'assignment'
image_block = 'image_block'
image_url_block = 'image_url_block'
link_block = 'link_block'

View File

@ -72,7 +72,7 @@ data = [
'text': 'Ich kann ein mündlich geführtes Interview in Standardsprache aufzeichnen.'
},
{
'text': 'Ich kann mein Arbeitsplatz genau beschreiben.'
'text': 'Ich kann meinen Arbeitsplatz genau beschreiben.'
},
]
}

View File

@ -50,6 +50,7 @@ INSTALLED_APPS = [
'objectives',
'rooms',
'filteredbook',
'assignments',
'wagtail.contrib.forms',
'wagtail.contrib.redirects',