Concept model relations

These are direct reimplementations of Django model relations, at the moment they only exist to make permissions-based filtering easier for the GraphQL codebase. However, in future these may add additional functionality such as automatically applying certain permissions to ensure users only retrieve the right objects.

When building models that link to any subclass of _concept, use these in place of the Django builtins.


The model these are place on does not need to be a subclass of concept. They are for linking to a concept subclass.

class aristotle_mdr.fields.ConceptForeignKey(to, on_delete, related_name=None, related_query_name=None, limit_choices_to=None, parent_link=False, to_field=None, db_constraint=True, **kwargs)[source]

Reimplementation of ForeignKey for linking a model to a Concept

class aristotle_mdr.fields.ConceptGenericRelation(to, object_id_field='object_id', content_type_field='content_type', for_concrete_model=True, related_query_name=None, limit_choices_to=None, **kwargs)[source]

Force relations on concept and subclasses to ONLY use the concept content type.


Return the content type associated with this field’s model.

class aristotle_mdr.fields.ConceptManyToManyField(to, related_name=None, related_query_name=None, limit_choices_to=None, symmetrical=None, through=None, through_fields=None, db_constraint=True, db_table=None, swappable=True, **kwargs)[source]

Reimplementation of ManyToManyField for linking a model to a Concept

class aristotle_mdr.fields.ConceptOneToOneField(to, on_delete, to_field=None, **kwargs)[source]

Reimplementation of OneToOneField for linking a model to a Concept

class aristotle_mdr.fields.LowerEmailField(*args, **kwargs)[source]

Reimplementation of email field, where email is always stored lowercase