This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I prefer to serve documents using a document slug (derived from the title of the document) | |
# instead of using the filename, especially since filenames can become quite ugly (appended random strings). | |
# E.g. a file named 'campus_map.pdf' with titel 'Campus Map' may be uploaded as 'campus_map_asRfsgt.pdf' | |
# by Wagtail and is then served as e.g. '/documents/24/campus_map_asRfsgt.pdf' (if WAGTAILDOCS_SERVE_METHOD = 'serve_view'). | |
# However, it would look much nicer, if it was served as '/documents/24/campus_map/', which could | |
# also be a more persistent document url, i.e. it would not change if the document object was changed by | |
# replacing the file with a new version (e.g. 'campus_map_v2.pdf'). | |
# I could also shorten the URL to '/documents/campus_map/', omitting the id. However, lookups by id are | |
# much faster and we would need to ensure that these urls are unique. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from modelcluster.fields import ParentalKey | |
from modelcluster.models import ClusterableModel | |
from wagtail.admin.edit_handlers import FieldPanel, MultiFieldPanel, InlinePanel | |
from wagtail.core.models import Orderable | |
from wagtail.search import index | |
from wagtailmodelchooser import register_filter | |
from wagtailmodelchooser.edit_handlers import ModelChooserPanel | |
""" |