apis_core.apis_entities package

Subpackages

Submodules

apis_core.apis_entities.abc module

class apis_core.apis_entities.abc.E21_Person(*args, **kwargs)[source]

Bases: Model

class Meta[source]

Bases: object

abstract = False
date_of_birth

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

date_of_death

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

forename

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

gender

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

surname

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class apis_core.apis_entities.abc.E53_Place(*args, **kwargs)[source]

Bases: Model

class Meta[source]

Bases: object

abstract = False
label

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

latitude

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

longitude

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class apis_core.apis_entities.abc.E74_Group(*args, **kwargs)[source]

Bases: Model

class Meta[source]

Bases: object

abstract = False
label

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

apis_core.apis_entities.api_views module

class apis_core.apis_entities.api_views.GetEntityGeneric(**kwargs)[source]

Bases: APIView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

get(request, pk)[source]
class apis_core.apis_entities.api_views.ListEntityGeneric(**kwargs)[source]

Bases: ListAPIView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

filter_backends = [<class 'apis_core.utils.filters.CustomSearchFilter'>]
get_queryset()[source]

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)

serializer_class

alias of MinimalEntitySerializer

apis_core.apis_entities.apps module

class apis_core.apis_entities.apps.EntitiesConfig(app_name, app_module)[source]

Bases: AppConfig

name = 'apis_core.apis_entities'

apis_core.apis_entities.autocomplete3 module

apis_core.apis_entities.fields module

class apis_core.apis_entities.fields.ListSelect2(url=None, forward=None, *args, **kwargs)[source]

Bases: Select2WidgetMixin, ListSelect2

Instanciate a widget with a URL and a list of fields to forward.

property media

Return JS/CSS resources for the widget.

class apis_core.apis_entities.fields.ModelSelect2(url=None, forward=None, *args, **kwargs)[source]

Bases: Select2WidgetMixin, ModelSelect2

Instanciate a widget with a URL and a list of fields to forward.

property media

Return JS/CSS resources for the widget.

class apis_core.apis_entities.fields.ModelSelect2Multiple(url=None, forward=None, *args, **kwargs)[source]

Bases: Select2WidgetMixin, ModelSelect2Multiple

Instanciate a widget with a URL and a list of fields to forward.

property media

Return JS/CSS resources for the widget.

class apis_core.apis_entities.fields.Select2(url=None, forward=None, *args, **kwargs)[source]

Bases: Select2WidgetMixin, Select2

Instanciate a widget with a URL and a list of fields to forward.

property media

Return JS/CSS resources for the widget.

class apis_core.apis_entities.fields.Select2Multiple(url=None, forward=None, *args, **kwargs)[source]

Bases: Select2WidgetMixin, Select2Multiple

Instanciate a widget with a URL and a list of fields to forward.

property media

Return JS/CSS resources for the widget.

class apis_core.apis_entities.fields.Select2WidgetMixin[source]

Bases: Select2WidgetMixin

property media

Return JS/CSS resources for the widget.

class apis_core.apis_entities.fields.TagSelect2(url=None, forward=None, *args, **kwargs)[source]

Bases: Select2WidgetMixin, TagSelect2

Instanciate a widget with a URL and a list of fields to forward.

property media

Return JS/CSS resources for the widget.

apis_core.apis_entities.filtersets module

class apis_core.apis_entities.filtersets.AbstractEntityFilterSet(*args, **kwargs)[source]

Bases: GenericFilterSet

class Meta[source]

Bases: Meta

exclude = ['rootobject_ptr', 'self_contenttype', 'triple_set_from_subj', 'triple_set_from_obj', 'uri', 'review', 'start_date', 'start_start_date', 'start_end_date', 'end_date', 'end_start_date', 'end_end_date', 'notes', 'text', 'published', 'status', 'references']
filter_overrides = {<class 'django.db.models.fields.CharField'>: {'extra': <function AbstractEntityFilterSet.Meta.<lambda>>, 'filter_class': <class 'django_filters.filters.CharFilter'>}}
form

alias of AbstractEntityFilterSetForm

base_filters = {}
declared_filters = {}
class apis_core.apis_entities.filtersets.AbstractEntityFilterSetForm(*args, **kwargs)[source]

Bases: GenericFilterSetForm

base_fields = {}
columns_exclude = ['rootobject_ptr', 'self_contenttype', 'triple_set_from_subj', 'triple_set_from_obj', 'uri']
declared_fields = {}
property media

Return all media required to render the widgets on this form.

class apis_core.apis_entities.filtersets.ModelSearchFilter(*args, **kwargs)[source]

Bases: CharFilter

This filter is a customized CharFilter that uses the generate_search_filter method to adapt the search filter to the model that is searched. It also extracts sets the help text based on the fields searched.

filter(qs, value)[source]
apis_core.apis_entities.filtersets.changed_since(queryset, name, value)[source]

apis_core.apis_entities.models module

class apis_core.apis_entities.models.AbstractEntity(*args, **kwargs)[source]

Bases: RootObject

Abstract super class which encapsulates common logic between the different entity kinds and provides various methods relating to either all or one specific entity kind.

Most of the class methods are designed to be used in the subclass as they are considering contexts which depend on the subclass entity type. So they are to be understood in that dynamic context.

class Meta[source]

Bases: object

abstract = False
get_duplicate_url()[source]
classmethod get_entity_list_filter()[source]
property get_next_id
classmethod get_or_create_uri(uri)[source]
property get_prev_id
merge_end_date_written(other)[source]
merge_start_date_written(other)[source]
rootobject_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

rootobject_ptr_id
apis_core.apis_entities.models.create_default_uri(sender, instance, created, raw, using, update_fields, **kwargs)[source]

apis_core.apis_entities.serializers module

class apis_core.apis_entities.serializers.MinimalEntitySerializer(*args, **kwargs)[source]

Bases: Serializer

When a field is instantiated, we store the arguments that were used, so that we can present a helpful representation of the object.

get_name(object) str[source]

apis_core.apis_entities.tables module

class apis_core.apis_entities.tables.AbstractEntityTable(data=None, order_by=None, orderable=None, empty_text=None, exclude=None, attrs=None, row_attrs=None, pinned_row_attrs=None, sequence=None, prefix=None, order_by_field=None, page_field=None, per_page_field=None, template_name=None, default=None, request=None, show_header=None, show_footer=True, extra_columns=None)[source]

Bases: GenericTable

class Meta[source]

Bases: Meta

sequence = ('...', 'view', 'edit', 'delete', 'noduplicate')
base_columns = {'delete': <apis_core.generic.tables.DeleteColumn object>, 'desc': <apis_core.generic.tables.DescriptionColumn object>, 'edit': <apis_core.generic.tables.EditColumn object>, 'noduplicate': <apis_core.apis_entities.tables.DuplicateColumn object>, 'view': <apis_core.generic.tables.ViewColumn object>}
class apis_core.apis_entities.tables.DuplicateColumn(*args, **kwargs)[source]

Bases: ActionColumn

A column showing a view button

permission = 'create'
template_name = 'columns/duplicate.html'

apis_core.apis_entities.urls module

class apis_core.apis_entities.urls.EntityToContenttypeConverter[source]

Bases: object

A converter that converts from a the name of an entity class (i.e. person) to the actual Django model class.

regex = '\\w+'
to_python(value)[source]
to_url(value)[source]

apis_core.apis_entities.utils module

apis_core.apis_entities.utils.get_entity_classes()[source]
apis_core.apis_entities.utils.get_entity_content_types()[source]

apis_core.apis_entities.views module

class apis_core.apis_entities.views.EntitiesAutocomplete(**kwargs)[source]

Bases: Select2QuerySetView

This endpoint allows us to use autocomplete over multiple model classes. It takes a parameter entities which is a list of ContentType natural keys and searches for the query in all instances of those entities (using generate_search_filter, which means it uses a different search approach for every model). The return values of the endpoint are then prefixed with the id of the contenttype of the results, separated by an underscore.

Example: Using this endpoint with the parameters:

?entities=apis_ontology.person&entities=apis_ontology.place&q=ammer

gives you all the persons and places that have ammer in their names and labels.

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

get_queryset()[source]

Filter the queryset with GET[‘q’].

get_result_value(result) str[source]

Return the value of a result.

class apis_core.apis_entities.views.EntitiesDuplicate(**kwargs)[source]

Bases: GenericModelMixin, PermissionRequiredMixin, View

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

get(request, *args, **kwargs)[source]
permission_action_required = 'create'