Change title in objective group model
This commit is contained in:
parent
58030fc70d
commit
9b6207f192
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="objective-group">
|
||||
<h4>{{group.title}}</h4>
|
||||
<h4>{{group.displayTitle}}</h4>
|
||||
|
||||
<ul class="objective-group__objective-list">
|
||||
<li class="objective-group__objective" v-for="objective in group.objectives" :key="objective.id">
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ query ModulesQuery($slug: String!) {
|
|||
node {
|
||||
id
|
||||
title
|
||||
displayTitle
|
||||
objectives {
|
||||
edges {
|
||||
node {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class ContentElementValueInput(InputObjectType):
|
|||
# we'll handle this with a single input, even tho it would be nice to have a type for every different possibility
|
||||
# see discussion at https://github.com/graphql/graphql-js/issues/207
|
||||
text = graphene.String(description='To be used for link_block, text_block types')
|
||||
url = graphene.String(description='To be used for link, basic_knowledge, image_block types')
|
||||
url = graphene.String(description='To be used for link, image_block types')
|
||||
description = graphene.String(description='To be used for basic_knowledge type')
|
||||
title = graphene.String(description='To be used for image_block, assignment type')
|
||||
assignment = graphene.String(description='To be used for assignment type')
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 2.0.6 on 2018-10-30 17:26
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('objectives', '0003_auto_20181022_1646'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='objectivegroup',
|
||||
name='title',
|
||||
field=models.CharField(blank=True, choices=[('language_communication', 'Sprache & Kommunikation'), ('society', 'Gesellschaft')], default='language_communication', max_length=255, verbose_name='title'),
|
||||
),
|
||||
]
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
from django.db import migrations
|
||||
|
||||
|
||||
def migrate_titles(apps, schema_editor):
|
||||
ObjectiveGroup = apps.get_model('objectives', 'ObjectiveGroup')
|
||||
for og in ObjectiveGroup.objects.filter(title='Sprache und Kommunikation'):
|
||||
og.title = 'language_communication'
|
||||
og.save()
|
||||
for og in ObjectiveGroup.objects.filter(title='Gesellschaft'):
|
||||
og.title = 'society'
|
||||
og.save()
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('objectives', '0004_auto_20181030_1726')
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(migrate_titles)
|
||||
]
|
||||
|
|
@ -9,7 +9,15 @@ class ObjectiveGroup(models.Model):
|
|||
verbose_name = 'Lernzielgruppe'
|
||||
verbose_name_plural = 'Lernzielgruppen'
|
||||
|
||||
title = models.CharField('title', blank=True, null=False, max_length=255)
|
||||
LANGUAGE_COMMUNICATION = 'language_communication'
|
||||
SOCIETY = 'society'
|
||||
|
||||
TITLE_CHOICES = (
|
||||
(LANGUAGE_COMMUNICATION, 'Sprache & Kommunikation'),
|
||||
(SOCIETY, 'Gesellschaft'),
|
||||
)
|
||||
|
||||
title = models.CharField('title', blank=True, null=False, max_length=255, choices=TITLE_CHOICES, default=LANGUAGE_COMMUNICATION)
|
||||
module = models.ForeignKey(Module, blank=False, null=False, on_delete=models.CASCADE, related_name='objective_groups')
|
||||
# a user can define her own objectives, hence this optional param
|
||||
user = models.ForeignKey(get_user_model(), blank=True, null=True, on_delete=models.CASCADE)
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ from objectives.models import ObjectiveGroup, Objective, ObjectiveProgressStatus
|
|||
|
||||
class ObjectiveGroupNode(DjangoObjectType):
|
||||
pk = graphene.Int()
|
||||
display_title = graphene.String()
|
||||
|
||||
class Meta:
|
||||
model = ObjectiveGroup
|
||||
|
|
@ -17,6 +18,10 @@ class ObjectiveGroupNode(DjangoObjectType):
|
|||
def resolve_pk(self, *args, **kwargs):
|
||||
return self.id
|
||||
|
||||
def resolve_display_title(self, *args, **kwargs):
|
||||
return self.get_title_display()
|
||||
|
||||
|
||||
|
||||
class ObjectiveNode(DjangoObjectType):
|
||||
pk = graphene.Int()
|
||||
|
|
|
|||
Loading…
Reference in New Issue