diff --git a/apis_core/apis_entities/forms.py b/apis_core/apis_entities/forms.py index 1a4341d70..59792f193 100644 --- a/apis_core/apis_entities/forms.py +++ b/apis_core/apis_entities/forms.py @@ -14,7 +14,7 @@ from apis_core.apis_metainfo.models import Uri, Collection from apis_core.apis_vocabularies.models import TextType -from apis_core.utils import DateParser, caching +from apis_core.utils import DateParser, caching, settings as apis_settings from .fields import ListSelect2, Select2Multiple if "apis_highlighter" in settings.INSTALLED_APPS: @@ -42,6 +42,9 @@ def get_entities_form(entity): :return: GenericEntitiesForm class """ + if form := apis_settings.get_entity_settings_by_modelname(entity).get("form"): + return form + class GenericEntitiesForm(forms.ModelForm): class Meta: model = caching.get_entity_class_of_name(entity) diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst index 4331cafe8..79c34f2e6 100644 --- a/docs/source/configuration.rst +++ b/docs/source/configuration.rst @@ -198,6 +198,7 @@ The example above is the default setting of the Place entity. allows to merge several entities in one target entity at once. ``search`` is an array and sets the fields that the search field searches. ``form_order`` defines the order of the fields in the metadata form of the respective entity. +``form`` allows you to set a custom form for the entity, instead of the default `apis_entities.forms.GenericEntityForm` ``table_fields`` sets the default columns to show in the list views. ``additional_cols`` allows to set the columns that user can add to the result view. ``relations_per_page`` allows to set the number of relations listed before pagination begins