diff --git a/server/books/migrate_document_model.py b/server/books/migrate_document_model.py new file mode 100644 index 00000000..ab4e5b82 --- /dev/null +++ b/server/books/migrate_document_model.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +# +# Iterativ GmbH +# http://www.iterativ.ch/ +# +# Copyright (c) 2015 Iterativ GmbH. All rights reserved. +# +# Created on 2022-07-28 +# @author: lorenz.padberg@iterativ.ch diff --git a/server/books/models/__init__.py b/server/books/models/__init__.py index 22837b3d..09f18a39 100644 --- a/server/books/models/__init__.py +++ b/server/books/models/__init__.py @@ -4,3 +4,4 @@ from .topic import * from .chapter import * from .contentblock import * from .snapshot import * +from .custom_document import * diff --git a/server/books/models/custom_document.py b/server/books/models/custom_document.py new file mode 100644 index 00000000..e719ef92 --- /dev/null +++ b/server/books/models/custom_document.py @@ -0,0 +1,13 @@ +from django.db import models + +from wagtail.documents.models import Document, AbstractDocument + + +class CustomDocument(AbstractDocument): + # Custom field example: + display_text = models.CharField( + max_length=1024, default='') + + admin_form_fields = Document.admin_form_fields + ( + 'display_text', + ) diff --git a/server/core/settings.py b/server/core/settings.py index c50d249a..8078e029 100644 --- a/server/core/settings.py +++ b/server/core/settings.py @@ -362,6 +362,8 @@ GRAPHENE = { # http://docs.wagtail.io/en/v2.1/advanced_topics/settings.html?highlight=urls WAGTAIL_SITE_NAME = 'skillbox' +WAGTAILDOCS_DOCUMENT_MODEL = 'books.CustomDocument' + GRAPHQL_QUERIES_DIR = os.path.join(BASE_DIR, '..', 'client', 'src', 'graphql', 'gql', 'queries') GRAPHQL_MUTATIONS_DIR = os.path.join(GRAPHQL_QUERIES_DIR, '../mutations')