diff --git a/server/vbv_lernwelt/learnpath/models.py b/server/vbv_lernwelt/learnpath/models.py index 55748138..84dd3c67 100644 --- a/server/vbv_lernwelt/learnpath/models.py +++ b/server/vbv_lernwelt/learnpath/models.py @@ -27,9 +27,6 @@ class LearningPath(Page): subpage_types = ['learnpath.Circle'] - graphql_fields = [ - GraphQLString("title", required=True), - ] class Meta: verbose_name = "Learning Path" @@ -53,11 +50,6 @@ class Topic(Orderable): FieldPanel('is_visible'), ] - graphql_fields = [ - GraphQLString("title"), - GraphQLBoolean("is_visible"), - ] - api_fields = [ APIField('title'), APIField('is_visible'), @@ -71,6 +63,8 @@ class Topic(Orderable): # parent_page_types = ['learnpath.LearningPath'] # subpage_types = ['learnpath.Circle'] + + def full_clean(self, *args, **kwargs): self.slug = find_available_slug(Topic, slugify(self.title, allow_unicode=True)) super(Topic, self).full_clean(*args, **kwargs) @@ -98,16 +92,9 @@ class Circle(Page, Orderable): content_panels = Page.content_panels + [ FieldPanel('description'), - FieldPanel('topic'), FieldPanel('goals'), InlinePanel('learning_sequences', label="Learning Sequences"), ] - # - graphql_fields = [ - GraphQLString("title", required=True), - GraphQLString("description"), - GraphQLString("goals"), - ] # Export fields over the API api_fields = [ @@ -155,12 +142,6 @@ class LearningSequence(Orderable): panels = [FieldPanel('title'), FieldPanel('category'), FieldPanel('circle')] - - graphql_fields = [ - GraphQLString("title", required=True), - GraphQLBoolean("category"), - ] - api_fields = [ APIField('title'), APIField('category'), @@ -192,15 +173,15 @@ class LearningPackage(Orderable): ) panels = [FieldPanel('title')] - graphql_fields = [ - GraphQLString("title", required=False), - ] - api_fields = [ APIField('title'), - APIField('learning_units'), + APIField('my_title'), ] + @property + def my_title(self): + return self.title + def full_clean(self, *args, **kwargs): self.slug = find_available_slug(LearningPackage, slugify(self.title, allow_unicode=True)) @@ -236,16 +217,10 @@ class LearningUnit(Page, Orderable): StreamFieldPanel('contents'), ] - graphql_fields = [ - GraphQLString("title", required=True), - GraphQLStreamfield('contents') - ] - - api_fields = [ APIField('title'), - - + APIField('contents'), + APIField('content_blocks'), ] subpage_types = []