heliport.gate_connection package

Subpackages

Submodules

heliport.gate_connection.admin module

Registers Django admin pages.

See django.contrib.admin.ModelAdmin from Django documentation.

heliport.gate_connection.apps module

Django app configuration.

Some HELIPORT hooks can be registered in app config django.apps.AppConfig.ready().

See also Django documentation

class heliport.gate_connection.apps.GateConnectionConfig(app_name, app_module)

Bases: AppConfig

App configuration for gate connection app.

name = 'heliport.gate_connection'
ready()

Import settings.

heliport.gate_connection.conf module

Additional settings for this app.

See also django appconf

class heliport.gate_connection.conf.GateConnectionAppConf(**kwargs)

Bases: AppConf

Settings of the heliport.gate_connection app.

All settings in this class can be overwritten in settings.py

class Meta

Bases: object

prefix = 'HELIPORT_GATE'
PASS = 'bar'
USER = 'foo'

heliport.gate_connection.interface module

Module with special name “interface” hooks into HELIPORT.

Some functions and heliport.core.app_interaction.Module subclasses are detected by HELIPORT and control how HELIPORT uses this app.

Note that this module must be imported in __init__.py of the django app.

class heliport.gate_connection.interface.GATEConnectionModule

Bases: Module

get_url(project)
icon = 'fa-solid fa-clipboard'
is_configured(project)
module_id = 'gate_connection'
name = 'GATE Connection'
heliport.gate_connection.interface.get_project_create_urls()
heliport.gate_connection.interface.get_search_url()
heliport.gate_connection.interface.serialize_project(project)

heliport.gate_connection.models module

Contains django.db.models.Model classes for Django ORM.

See Quick example from Django documentation. In HELIPORT the heliport.core.models.DigitalObject can be subclassed for models containing metadata in a project.

class heliport.gate_connection.models.GateProject(digital_object_id, persistent_id, generated_persistent_id, category, label, label_is_public, description, description_is_public, created, last_modified, last_modified_is_public, deleted, permission, special_heliport_role, is_helper, projects_is_public, owner, members_is_public, digitalobject_ptr, gate_id, status, proposal, restricted, responsible_experimentalist)

Bases: DigitalObject

exception DoesNotExist

Bases: DoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

property abstract
property co_proposer
digitalobject_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.

digitalobject_ptr_id
disable_copy = True
experimentalists

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

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

gate_id

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

local_contacts

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

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

proposal

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

property proposer
responsible_experimentalist

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.

responsible_experimentalist_id
restricted

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

status

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

property title
class heliport.gate_connection.models.GateUser(gate_user_id, gate_id, heliport_user)

Bases: Model

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

gate_id

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

gate_user_id

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

heliport_user

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.

heliport_user_id
objects = <django.db.models.manager.Manager object>
class heliport.gate_connection.models.ProposalQueries

Bases: GateQueries

static create_or_update_gate_project(gate_project: GateProject)
class heliport.gate_connection.models.ProposalUserQueries

Bases: UserQueries

static create_user()
static get_user_by_gate_id(gate_id)
static get_user_by_ldap_id(ldap_id)
static get_user_by_ldap_id_check_gate_duplication(ldap_id, gate_id)
static update_user(user, display_name, ldap_id, gate_id=None, affiliation=None, email=None)

Update the heliport user with the provided attributes.

Additionally, the GateUser is updated if gate_id is provided.

heliport.gate_connection.serializers module

This module is for serialization into Datacite, RDF and JSON.

The JSON format is used for API endpoints via Django rest framework. Using this, it is typical to put the serializer classes into a “serializers.py” file.

For the serialization into RDF, attributes are described. See heliport.core.attribute_description.BaseAttribute for more detail.

class heliport.gate_connection.serializers.GateProjectSerializer(*args, **kwargs)

Bases: ModelSerializer

class Meta

Bases: object

fields = ['gate_id', 'label', 'status', 'owner', 'co_owners', 'description', 'proposal', 'restricted', 'responsible_experimentalist', 'local_contacts', 'projects', 'experimentalists']
model

alias of GateProject

class heliport.gate_connection.serializers.GateUserSerializer(*args, **kwargs)

Bases: ModelSerializer

class Meta

Bases: object

fields = ['gate_user_id', 'gate_id', 'heliport_user']
model

alias of GateUser

heliport.gate_connection.tasks module

heliport.gate_connection.tests module

Test the behaviour of this app.

This follows the Writing tests guide in Django.

heliport.gate_connection.urls module

Map django views to urls.

See this Example including explanation from the Django documentation.

heliport.gate_connection.views module

Contains Django View classes to handle HTTP requests.

See Using class-based views from Django documentation. In HELIPORT heliport.core.mixins are used to create uniform views. Also heliport.core.views.generic.HeliportObjectListView is used to quicly create a typical HELIPORT list view.

class heliport.gate_connection.views.ConnectToGateProjectView(**kwargs)

Bases: HeliportProjectMixin, ListView

context_object_name = 'gate_project_list'
get_context_data(*, object_list=None, **kwargs)

Add extra context for rendering template (Called by django base view).

The extra context includes the search query.

get_queryset()
model

alias of GateProject

post(request, *args, **kwargs)
template_name = 'gate_connection/gate_connect.html'
class heliport.gate_connection.views.ConnectedToGateProjectView(**kwargs)

Bases: HeliportProjectMixin, DetailView

get(request, *args, **kwargs)
get_context_data(**kwargs)

Add extra context for rendering template (Called by django base view).

The extra context includes information about the GATE project.

model

alias of Project

pk_url_kwarg = 'project'
post(request, *args, **kwargs)
template_name = 'gate_connection/gate_connected.html'
class heliport.gate_connection.views.GateProjectViewSet(**kwargs)

Bases: HeliportModelViewSet

Gate Project.

filterset_fields = ['gate_id', 'label', 'owner', 'co_owners', 'proposal', 'restricted', 'responsible_experimentalist', 'local_contacts', 'projects', 'status', 'experimentalists']
get_queryset()
serializer_class

alias of GateProjectSerializer

class heliport.gate_connection.views.GateUserViewSet(**kwargs)

Bases: ModelViewSet

Gate User.

filterset_fields = ['gate_user_id', 'gate_id', 'heliport_user']
get_queryset()
permission_classes = [<class 'rest_framework.permissions.IsAuthenticated'>, <class 'heliport.core.permissions.StaffOrReadOnly'>]
serializer_class

alias of GateUserSerializer

class heliport.gate_connection.views.ProjectCreateView(**kwargs)

Bases: HeliportLoginRequiredMixin, View

get(request, *args, **kwargs)
class heliport.gate_connection.views.SearchView(**kwargs)

Bases: HeliportLoginRequiredMixin, TemplateView

get_context_data(**kwargs)

Add extra context for rendering template (Called by django base view).

The extra context includes the search results.

template_name = 'gate_connection/search.html'

Module contents

App to store and import metadata from the HZDR proposal system GATE.

The interface module is imported to the top level of the package for HELIPORT app interface discovery (see heliport.core.app_interaction.get_heliport_apps()).