heliport.tables package

Subpackages

Submodules

heliport.tables.admin module

Registers Django admin pages.

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

heliport.tables.apps module

Django app configuration.

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

See also Django documentation

class heliport.tables.apps.TablesConfig(app_name, app_module)

Bases: AppConfig

App configuration for the tables app.

name = 'heliport.tables'

heliport.tables.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.tables.interface.Tables

Bases: DigitalObjectModule

get_url(project)

Return the URL for the entry point of this module.

module_id = 'tables'
name = 'Tables'
property object_class

Table.

heliport.tables.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.tables.models.Table(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, table_id)

Bases: DigitalObject

exception DoesNotExist

Bases: DoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

as_dict()
property columns
property columns_reversed
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
table_id

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

tablecolumn_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.

tablerow_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 heliport.tables.models.TableCell(cell_id, row, column, contents, image, evaluated_contents, last_update)

Bases: Model

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

as_dict()
cell_id

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

column

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.

column_id
contents

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

evaluated_contents

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

get_next_by_last_update(*, field=<django.db.models.fields.DateTimeField: last_update>, is_next=True, **kwargs)
get_previous_by_last_update(*, field=<django.db.models.fields.DateTimeField: last_update>, is_next=False, **kwargs)
image

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.

image_id
last_update

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>
row

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.

row_id
class heliport.tables.models.TableColumn(column_id, label, index, column_type, parent_table)

Bases: Model

class ColumnTypes(value)

Bases: IntegerChoices

An enumeration.

IMAGE = 3
NUMBER = 4
TEXT = 1
TIMESTAMP = 2
exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

as_dict()
column_id

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

column_type

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

get_column_type_display(*, field=<django.db.models.fields.IntegerField: column_type>)
index

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

label

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_table

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_table_id
tablecell_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 heliport.tables.models.TableRow(row_id, creation_date, parent_table)

Bases: Model

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

as_dict()
creation_date

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

get_next_by_creation_date(*, field=<django.db.models.fields.DateTimeField: creation_date>, is_next=True, **kwargs)
get_previous_by_creation_date(*, field=<django.db.models.fields.DateTimeField: creation_date>, is_next=False, **kwargs)
objects = <django.db.models.manager.Manager object>
parent_table

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_table_id
row_id

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

tablecell_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.

heliport.tables.tests module

Test the behaviour of this app.

This follows the Writing tests guide in Django.

heliport.tables.urls module

Map django views to urls.

See this Example including explanation from the Django documentation.

heliport.tables.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.tables.views.TableDataView(**kwargs)

Bases: HeliportObjectMixin, DetailView

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

alias of Table

class heliport.tables.views.TableDeleteColumnView(**kwargs)

Bases: HeliportObjectMixin, DetailView

model

alias of Table

post(request, *args, **kwargs)
class heliport.tables.views.TableDeleteRowView(**kwargs)

Bases: HeliportObjectMixin, DetailView

model

alias of Table

post(request, *args, **kwargs)
class heliport.tables.views.TableEditView(**kwargs)

Bases: HeliportObjectMixin, DetailView

get_context_data(**kwargs)

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

As a side effect an image is added to a cell if requested via URL arguments. This is required because the heliport.core.views.images.TakePictureView links back to this view including GET parameters of the picture that was taken.

model

alias of Table

template_name = 'tables/table.html'
class heliport.tables.views.TableResetCellView(**kwargs)

Bases: HeliportObjectMixin, DetailView

model

alias of Table

post(request, *args, **kwargs)
class heliport.tables.views.TableUpdateColumnView(**kwargs)

Bases: HeliportObjectMixin, DetailView

model

alias of Table

post(request, *args, **kwargs)
class heliport.tables.views.TableUpdateRowView(**kwargs)

Bases: HeliportObjectMixin, DetailView

static extract_request_data(request)
model

alias of Table

post(request, *args, **kwargs)
class heliport.tables.views.TablesView

Bases: HeliportObjectListView

action_open(obj)
actions = [('Open', 'action_open', 'link'), ('Edit', 'action_edit', 'link_secondary'), ('Delete', 'action_delete', 'danger')]

Actions that are available for each column. Triples of action name, method name called on the HeliportObjectListView # noqa: E501 and style information. For more control over action overwrite register_actions(). # noqa: E501 See implementation of register_actions() for definitions of style information. # noqa: E501

category = 'HELIPORT/table'

Namespace used for handle generation

columns = [('ID', 'table_id', 'small'), ('Name', 'label', 'large')]

Columns shown in the table. Triples of column name, attribute shown in column, column size. # noqa: E501 For more control over columns overwrite register_columns(). See implementation of register_columns() for definition of column sizes

create_heading = 'Add a Table'

Text displayed as heading over form when creating obj. See also get_create_heading(). # noqa: E501

edit_fields = [('Name', 'label', 'normal'), ('Description', 'description', 'large')]

Fields editable in this view. Triple of key name, attribute name ware value is stored and field style For more control over form fields overwrite register_form_columns(). See implementation of register_form_columns() for definitions of field styles. # noqa: E501

list_heading = 'Tables'

Text displayed as heading

list_url = 'tables:list'

Url that leads to this view for listing objects. The list_url attribute should be a string that is valid when passed to Django’s reverse() function with kwarg “project”. list_url is required by the default action_edit() implementation to link back to original page after editing.

model

alias of Table

update_url = 'tables:edit_in_list'

Url that leads to this view for updating. The “update_url” string is passed to django.urls.reverse() with “project” and “pk” url arguments to get the actual url. update_url is required by the default action_edit() implementation.

Module contents

App to store tabular information including images, text and calculations.

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()).