register_concept to connect new concept types¶
Aristotle-MDR concept register¶
This module allows developers to easily register new concept models with the core
functionality of Aristotle-MDR. The
register_concept is a wrapper around three
methods that registers a new concept with the Django-Admin site, with the
Django-Autocomplete and with a class for a Haystack search index. This is all done
in a way that conforms to the permissions required for control item visibility.
Other methods in this module can be called, to highly customise how concepts are used within the admin site and search, but should be considered internal methods and future releases of Aristotle-MDR may break code that uses these methods.
register_concept(concept_class, *args, **kwargs)¶
A handler for third-party apps to make registering extension models based on
Sets up the version controls, search indexes, django administrator page and autocomplete handlers. All
kwargsare passed to the called methods. For examples of what can be passed into this method review the other methods in
Example usage (based on the models in the extensions test suite):register_concept(Question, extra_fieldsets=[(‘Question’,’question_text’),]
register_concept_admin(concept_class, *args, **kwargs)¶
Registers the given
conceptwith the Django admin backend based on the default
Additional parameters are only required if a model has additional fields or references to other models.
- auto_fieldsets (boolean) – If no extra_fieldsets, when set to true this generates a list of fields for the admin page as “Extra fields for [class]”
- concept_class (concept) – The model that is to be registered
- extra_fieldsets (list) – Model-specific fieldsets to be displayed. Fields in the tuples given should be those not defined by the base
- extra_inlines (list) – Model-specific inline admin forms to be displayed.
register_concept_search_index(concept_class, *args, **kwargs)¶
Registers the given
conceptwith a Haystack search index that conforms to Aristotle permissions. If the concept to be registered does not have a template for serving a search document, a basic document with just the basic fields from
aristotle_mdr.models._conceptwill be used when indexing items.
Parameters: concept_class (concept) – The model that is to be registered for searching.