apis_core.collections package

Subpackages

Submodules

apis_core.collections.admin module

apis_core.collections.apps module

class apis_core.collections.apps.VocabsConfig(app_name, app_module)[source]

Bases: AppConfig

default_auto_field = 'django.db.models.AutoField'
name = 'apis_core.collections'
ready()[source]

Override this method in subclasses to run code when Django starts.

apis_core.collections.models module

class apis_core.collections.models.SkosCollection(*args, **kwargs)[source]

Bases: GenericModel, Model

SKOS collections are labeled and/or ordered groups of SKOS concepts. Collections are useful where a group of concepts shares something in common, and it is convenient to group them under a common label, or where some concepts can be placed in a meaningful order.

Miles, Alistair, and Sean Bechhofer. “SKOS simple knowledge organization system reference. W3C recommendation (2009).”

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

children()[source]
children_tree_as_list()[source]
contributor

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

creator

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

id

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

label_lang

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

name

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

objects = <django.db.models.manager.Manager object>
parent

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

parent_id
skoscollection_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

skoscollectioncontentobject_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class apis_core.collections.models.SkosCollectionContentObject(*args, **kwargs)[source]

Bases: GenericModel, Model

Throughtable datamodel to connect collections to arbitrary content

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

collection

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

collection_id
content_object

Provide a generic many-to-one relation through the content_type and object_id fields.

This class also doubles as an accessor to the related object (similar to ForwardManyToOneDescriptor) by adding itself as a model attribute.

content_type

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

content_type_id
id

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

object_id

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

objects = <django.db.models.manager.Manager object>

apis_core.collections.signals module

apis_core.collections.signals.add_to_session_collection(sender, instance, created, raw, using, update_fields, **kwargs)[source]

Add a created apis_core.history model instance to all the SkosCollections that are listed in the session_collections session variable. This needs the ‘crum.CurrentRequestUserMiddleware’ middleware to be enabled.

apis_core.collections.tables module

class apis_core.collections.tables.SkosCollectionContentObjectTable(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

base_columns = {'delete': <apis_core.generic.tables.DeleteColumn object>, 'desc': <apis_core.generic.tables.DescriptionColumn object>, 'edit': <apis_core.generic.tables.EditColumn object>, 'target': <django_tables2.columns.templatecolumn.TemplateColumn object>, 'view': <apis_core.generic.tables.ViewColumn object>}

apis_core.collections.urls module

apis_core.collections.views module

class apis_core.collections.views.CollectionObjectParent(**kwargs)[source]

Bases: LoginRequiredMixin, ContentObjectMixin, TemplateView

Change the requested CollectionObjects collection to point to the parent of the current collection.

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

get_context_data(*args, **kwargs)[source]
template_name = 'collections/collection_object_parent.html'
class apis_core.collections.views.CollectionSessionToggle(**kwargs)[source]

Bases: LoginRequiredMixin, TemplateView

Toggle the existence of an SkosCollection in the session_collections session variable. This can be used in combination with the collections.signals.add_to_session_collection signal, to add objects to a collection if the collections id is listed in the session variable. The equivalent templateatag that calls this view is collections.templatetags.collections.collection_session_toggle_by_id

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

get(*args, **kwargs)[source]
get_context_data(*args, **kwargs)[source]
template_name = 'collections/collection_session_toggle.html'
class apis_core.collections.views.CollectionToggle(**kwargs)[source]

Bases: LoginRequiredMixin, ContentObjectMixin, TemplateView

Toggle a collection - if a CollectionObject connecting the requested object and collection does not exist, then create it. If it does exist, delete it.

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

get(*args, **kwargs)[source]
get_context_data(*args, **kwargs)[source]
setup(*args, **kwargs)[source]

Initialize attributes shared by all view methods.

template_name = 'collections/collection_toggle.html'
class apis_core.collections.views.ContentObjectMixin[source]

Bases: object

Setup the ContentType and the object used by a view, based on the content_type_id and the object_id arguments passed in the URL.

get_context_data(*args, **kwargs)[source]
setup(*args, **kwargs)[source]