Add custom Document Model (No migration)

This commit is contained in:
Lorenz Padberg 2022-07-28 15:56:58 +02:00
parent 9fea218dd3
commit 4d13d5e42d
4 changed files with 25 additions and 0 deletions

View File

@ -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

View File

@ -4,3 +4,4 @@ from .topic import *
from .chapter import *
from .contentblock import *
from .snapshot import *
from .custom_document import *

View File

@ -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',
)

View File

@ -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')