Models
This is the documentation of NdrCore’s database models.
models.py contains ndr_core’s database models.
- class ndr_core.models.NdrCoreApiImplementation(*args, **kwargs)
NDR Core has different API implementations to target different APIS. They are saved in this model.
- exception DoesNotExist
- exception MultipleObjectsReturned
- connection_string_example
Example connection string.
- description
Description of this implementation.
- label
Display Label of the implementation.
- name
Name of the API implementation. Used as identifier, can’t contain special characters.
- ndrcoresearchconfiguration_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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- objects = <django.db.models.manager.Manager object>
- supports_advanced
True if the API supports a field based search where different search values can be searched for different fields.
- supports_simple
True if the API supports a catch all search with a simple search term.
- supports_simple_and_or
True if the API supports an AND and OR option for the simple search.
- supports_single_result
True if a single result can be downloaded.
- url
URL of API homepage or documentation.
- class ndr_core.models.NdrCoreColorScheme(*args, **kwargs)
The NDR Core UI styles get colored with a certain color scheme. The selected scheme is used to create a colors.css stylesheet file in your ndr installation. It gets regenerated when you change the selected scheme.
- exception DoesNotExist
- exception MultipleObjectsReturned
- accent_color_1
Accent color 1.
- accent_color_2
Accent color 2.
- background_color
Basic background color of the whole page.
- brand_panel_bg
Background color of the brand panel.
- brand_panel_text
Text color of the brand panel.
- button_border_color
Border color of primary buttons.
- button_color
Background color of primary buttons.
- button_hover_color
Hover color of primary buttons.
- button_text_color
Text color of primary buttons.
- static color_list()
Returns a list of all color fields. This is used to generate the colors.css file.
- container_bg_color
Basic container (cards, tables, etc.) color of the whole page.
- dark_accent_color_1
Accent color 1 for dark mode.
- dark_accent_color_2
Accent color 2 for dark mode.
- dark_background_color
Background color for dark mode.
- dark_brand_panel_bg
Brand panel background color for dark mode.
- dark_brand_panel_text
Brand panel text color for dark mode.
- dark_button_border_color
Primary button border color for dark mode.
- dark_button_color
Primary button background color for dark mode.
- dark_button_hover_color
Primary button hover color for dark mode.
- dark_button_text_color
Primary button text color for dark mode.
- dark_container_bg_color
Container background color for dark mode.
- dark_error_color
Error alert color for dark mode.
Footer background color for dark mode.
Footer link color for dark mode.
Footer link hover color for dark mode.
- dark_form_field_bg
Form field background color for dark mode.
- dark_form_field_fg
Form field text color for dark mode.
- dark_info_color
Info alert color for dark mode.
- dark_link_color
Link color for dark mode.
Active navigation link color for dark mode.
Navigation link color for dark mode.
- dark_powered_by_color
Powered by text color for dark mode.
- dark_second_button_border_color
Secondary button border color for dark mode.
- dark_second_button_color
Secondary button background color for dark mode.
- dark_second_button_hover_color
Secondary button hover color for dark mode.
- dark_second_button_text_color
Secondary button text color for dark mode.
- dark_success_color
Success alert color for dark mode.
- dark_tab_active_title_color
Active tab title color for dark mode.
- dark_tab_title_color
Tab title color for dark mode.
- dark_text_color
Text color for dark mode.
- dark_title_color
Title color for dark mode.
- error_color
Error color for alerts.
- font_family
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Background color of the footer.
Color of links in the footer.
Color of links in the footer.
- form_field_bg
Background color of form fields.
- form_field_fg
Foreground color of form fields.
- h1_size
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- h2_size
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- h3_size
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- h4_size
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- info_color
Info color for alerts.
- link_color
Color for hrefs.
Color for hrefs.
Color for hrefs.
- objects = <django.db.models.manager.Manager object>
- powered_by_color
Color of the powered by text.
- scheme_label
Human readable label of the scheme
- scheme_name
The name of the color scheme. For display and reference.
- second_button_border_color
Border color of secondary buttons.
- second_button_color
Basic color of secondary buttons.
- second_button_hover_color
Hover color of secondary buttons.
- second_button_text_color
Text color of secondary buttons.
- success_color
Success color for alerts.
- tab_active_title_color
Color for active tab titles.
- tab_title_color
Color for tab titles.
- text_color
Basic text color for the whole page.
- title_color
Title text color for the whole page.
- class ndr_core.models.NdrCoreCorrectedField(*args, **kwargs)
A field correction is part of a correction. It consists of a field name, the old value and the new value.
- exception DoesNotExist
- exception MultipleObjectsReturned
- field_name
The field name which is corrected.
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- ndr_correction
The correction which this field correction is part of.
- ndr_correction_id
- new_value
The new value of the field.
- objects = <django.db.models.manager.Manager object>
- old_value
The old value of the field.
- class ndr_core.models.NdrCoreCorrection(*args, **kwargs)
Users can be given the opportunity to correct entries which have errors. Each correction can consist of multiple field corrections. Users need to provide an ORCID. This does not automatically correct data but administrators can accept or reject corrections.
- exception DoesNotExist
- exception MultipleObjectsReturned
- corrected_dataset
The dataset which is corrected.
- corrected_dataset_id
- corrected_record_id
The record ID of the corrected record.
- corrector_orcid
The ORCID of the corrector.
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- ndrcorecorrectedfield_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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- objects = <django.db.models.manager.Manager object>
- class ndr_core.models.NdrCoreImage(*args, **kwargs)
Simple image library for storing images. Contextual data (title, caption, etc.) is handled by NdrCoreUiElementItem when the image is used.
- exception DoesNotExist
- exception MultipleObjectsReturned
- alt_text
Alt text for accessibility (important for screen readers)
- get_absolute_url()
Returns the absolute url of the image.
- get_next_by_uploaded_at(*, field=<django.db.models.fields.DateTimeField: uploaded_at>, is_next=True, **kwargs)
- get_previous_by_uploaded_at(*, field=<django.db.models.fields.DateTimeField: uploaded_at>, is_next=False, **kwargs)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- image
Actual image file
- image_active
To indicate that this image is not to be used in automatic collections.
- ndrcoreuielementitem_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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- objects = <django.db.models.manager.Manager object>
- page_backgrounds
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- page_backgrounds_dark
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- uploaded_at
Timestamp when the image was uploaded
- class ndr_core.models.NdrCoreManifest(*args, **kwargs)
Directory of all manifests.
- exception DoesNotExist
- exception MultipleObjectsReturned
- file
Actual file
- get_file_size()
Returns file size in bytes.
- get_file_size_display()
Returns human-readable file size.
- identifier
Identifier of the manifest. Is used to reference the manifest in the code.
- manifest_group
Group of the manifest
- manifest_group_id
- objects = <django.db.models.manager.Manager object>
- order_value_1
Order value 1
- order_value_2
Order value 2
- order_value_3
Order value 3
- title
Title of the upload
- class ndr_core.models.NdrCoreManifestGroup(*args, **kwargs)
Directory of all manifest groups.
- exception DoesNotExist
- exception MultipleObjectsReturned
- get_manifest_count()
Returns the number of manifests in this group.
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- ndrcoremanifest_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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- ndrcoreuielementitem_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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- objects = <django.db.models.manager.Manager object>
- order_value_1_title
Order value 1 title
- order_value_2_title
Order value 2 title
- order_value_3_title
Order value 3 title
- title
Title of the manifest group.
- class ndr_core.models.NdrCorePage(*args, **kwargs)
An NdrCorePage is a web page on the ndr_core website instance. Each page has a type (see PageType) and upon creation, an HTML template is created and saved in the projects template folder. This allows users to create pages over the administration interface and then adapt its contents as needed.
- class BackgroundDisplayMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Display modes for background images.
- FIXED_PARALLAX = 'FIXED_PARALLAX'
- FULL_VIEWPORT = 'FULL_VIEWPORT'
- HEADER_ONLY = 'HEADER_ONLY'
- INHERIT = 'INHERIT'
- NONE = 'NONE'
- exception DoesNotExist
- exception MultipleObjectsReturned
- class PageType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Ndr Core can display multiple page types which are listed in this choice class
- ABOUT_PAGE = 8
TODO
- CONTACT = 5
A contact from page displays a form to send a message to the project team
- DATA_LIST = 4
A data list page displays a list of data entries.
- FLIP_BOOK = 7
TODO
- SEARCH = 3
A search page features a configured search form which contains a number of search fields
- TEMPLATE = 1
A template page is a static page. A HTML template is created which can be filled with any content
- background_display_mode
Determines how the background image is displayed on the page.
- background_image
The background image to display on this page.
- background_image_dark
The background image to display on this page in dark mode.
- background_image_dark_id
- background_image_id
- background_position
CSS background-position property.
- background_size
CSS background-size property.
- center_content
If True, the page content will be vertically centered in the viewport.
- get_background_display_mode_display(*, field=<django.db.models.fields.CharField: background_display_mode>)
- get_next_by_last_modified(*, field=<django.db.models.fields.DateTimeField: last_modified>, is_next=True, **kwargs)
- get_page_type_display(*, field=<django.db.models.fields.IntegerField: page_type>)
- get_previous_by_last_modified(*, field=<django.db.models.fields.DateTimeField: last_modified>, is_next=False, **kwargs)
- get_resolved_background_settings()
Returns the resolved background settings for this page. If the page uses default settings or INHERIT mode, returns default settings from NdrCoreValue. Otherwise, returns page-specific settings.
Returns a dict with keys: bg_image, bg_image_dark, bg_mode, bg_position, bg_size, overlay_enabled, overlay_color, overlay_opacity
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- index
The index determines the order the pages are displayed. 0 comes first (=most left)
- label
This is the navigation label which is displayed in the navigation. This value is translatable.
- last_modified
The last time the page was modified.
- name
This is the name/title of the page. It will be displayed as a <h2>title</h2>. This value is translatable.
For the navigation, fontawesome icons can be displayed (e.g. ‘fas fa-home’)
- ndrcorepage_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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- objects = <django.db.models.manager.Manager object>
- overlay_color
The color of the overlay (hex format).
- overlay_enabled
If True, adds a semi-transparent overlay over the background image.
- overlay_opacity
Opacity of the overlay (0.0 to 1.0).
- page_type
The page_type determines what kind of page is generated and what View is called (see PageType)
- parent_page
Any NDR Core page might have children. Currently used for flip book. In the future to be used as navigation hierarchy.
- parent_page_id
- search_configs
If the page is of one of the search types (SEARCH, COMBINED_SEARCH), a number of search configurations can be saved.
If False, the footer will be hidden on this page.
If this is set to False, the page will not be displayed in the navigation.
If False, the navigation bar will be hidden on this page.
- show_page_title
If this is set to False, the page title will not be displayed.
- template_text
Template Pages can be filled with RichText content (instead of ‘manual’ HTML).
- translated_template_text()
Returns the translated template_text for a given language. If no translation exists, the default template_text is returned.
- url()
Returns the url of a given page or ‘#’ if none is found
- use_default_background
If True, the page will use the installation’s default background settings.
- view_name
The view_name is part of the page url in the form: https://yourdomain.org/p/view_name
- class ndr_core.models.NdrCoreResultField(*args, **kwargs)
An NdrCoreResultField is part of the display of a search result. Multiple result fields can be combined to a result card. Each result field has a type (see FieldType) which determines how the field is displayed. The expression (or rich_expression) is formed by mixing static text with data from the result. Example:
The data provides a field ‘person’. Its value is an object containing the fields ‘first_name’ and ‘last_name’. The expression is ‘Hello {person[first_name]} {person[last_name]}!’. The result field will display the text ‘Hello John Doe!’ if the data contains the fields ‘person.first_name’ and ‘person.last_name’.
- exception DoesNotExist
- exception MultipleObjectsReturned
- border_label
Label text to display on the top border of the field box
- field_classes
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.
- is_tab_container
Marks this field as a tab container. When true, rich_expression is ignored and tab_children is rendered.
- label
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- ndrcoreresultfieldcardconfiguration_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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- ndrcoreuielementitem_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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- objects = <django.db.models.manager.Manager object>
- rich_expression
The expression to display. This can be a static text or a template string which is filled with data from the result. Rich text can be styled (bold, italic, etc.)
- tab_children
Configuration for tabs. Each entry should have ‘tab_label’, ‘result_field_id’, and optional ‘tab_order’.
- class ndr_core.models.NdrCoreResultFieldCardConfiguration(*args, **kwargs)
Result fields can be used in cards. In order to place them, they can be configured to fit in a grid with a NdrCoreResultFieldCardConfiguration.
- exception DoesNotExist
- exception MultipleObjectsReturned
- field_column
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- field_column_span
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- field_row
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- field_row_span
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_result_card_group_display(*, field=<django.db.models.fields.CharField: result_card_group>)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- ndrcoresearchconfiguration_set
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.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- objects = <django.db.models.manager.Manager object>
- result_card_group
The group of the result card. Normal is the default group.
- result_field
The result field to place in a card
- result_field_id
- class ndr_core.models.NdrCoreRichTextTranslation(*args, **kwargs)
NdrCoreRichTextTranslation is used to translate rich text fields.
- exception DoesNotExist
- exception MultipleObjectsReturned
- field_name
Name of the field to translate.
- get_table_name_display(*, field=<django.db.models.fields.CharField: table_name>)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- language
Language of the translation. Should be a language returned by get_available_languages().
- object_id
ID of the object the field belongs to.
- objects = <django.db.models.manager.Manager object>
- table_name
Name of the table the field belongs to.
- translation
Template Pages can be filled with RichText content (instead of ‘manual’ HTML).
- class ndr_core.models.NdrCoreSearchConfiguration(*args, **kwargs)
A search configuration describes a configured search.
- exception DoesNotExist
- exception MultipleObjectsReturned
- api_auth_key
An API might need an authentication key to function.
- api_connection_url
Connection URL for the API endpoint.
- api_password
An API might need to authenticate a user with username/password credentials.
- api_type
Refers to the API implementation used for this configuration.
- api_type_id
- api_user_name
An API might need to authenticate a user with username/password credentials.
- citation_expression
Expression to generate a citation for a result.
- compact_page_size
The query results will return a page of the results. You can define the page size
- compact_result_is_default
If the compact result view is the default, check this box.
- conf_label
Label of the search configuration. This is the name which is displayed in the search form. This value is translatable.
- conf_name
Name of the search configuration. Can’t contain spaces or special characters. Can’t be ‘simple’. Used as identifier.
- data_list_filters
Search fields that will be applied as filters in data list pages using their initial values
- get_sort_order_display(*, field=<django.db.models.fields.CharField: sort_order>)
- has_simple_search
Should this configuration feature a simple search?
- manifest_page_expression
Expression to generate a link to a page in a manifest.
- manifest_relation_expression
Expression to generate a relation to a manifest for a result.
- ndrcorecorrection_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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- ndrcorepage_set
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.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- ndrcoresearchstatisticentry_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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- ndrcoreuielementitem_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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- objects = <django.db.models.manager.Manager object>
- page_size
The query results will return a page of the results. You can define the page size
- repository_url
URL to the repository’s website.
- result_card_fields
Result fields associated with this configuration
- result_card_template
The template to use for the result cards.
- search_form_fields
Fields associated with this configuration
- search_has_compact_result
If the result has a normal and a compact view, check this box.
- search_id_field
The ID field to identify an entry.
- simple_query_help_text
The help text for the simple search field. This value is translatable.
- simple_query_label
The label for the simple search field. This value is translatable.
- simple_query_main_field
The main field to query for a simple search.
- simple_search_first
Should the simple search be displayed first?
- simple_search_tab_title
The title for the simple search tab. This value is translatable.
- sort_field
The field to sort the result by.
- sort_order
The order to sort the result by.
- class ndr_core.models.NdrCoreSearchField(*args, **kwargs)
A NdrCoreSearch field serves two purposes: First it can produce an HTML form field and second its information is used to formulate an API request.
- exception DoesNotExist
- class FieldType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
The FieldType of a searchField is used to render the HTML form and to determine the type of the API request.
- BOOLEAN = 5
This type produces a checkbox
- BOOLEAN_LIST = 11
This type produces a list of checkboxes
- DATE = 6
This type produces a date field
- DATE_RANGE = 7
This type produces a date range field
- FLOAT = 12
This type produces a float number field
- HIDDEN = 9
This type produces a hidden field
- INFO_TEXT = 10
This type produces a HTML component to show info text. This is not an input field
- LIST = 3
This field produces a dropdown list
- MULTI_LIST = 4
This field produces a multi select field
- NUMBER = 2
This type produces a number field
- NUMBER_RANGE = 8
This type produces a number range field
- STRING = 1
This type produces a text field
- exception MultipleObjectsReturned
- api_parameter
The name of the API parameter which is used to generate a query
- comparison_operator
Comparison operator for number, float, date, and string fields
- data_field_type
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- field_label
The field_label is the label for the HTML form field
- field_name
The field_name is used as the HTML form name. This value is translatable.
- field_required
Sets a field to ‘required’ which means it can’t be blank
- field_type
Type of the form field. This translates to the HTML input type
- get_choices(null_choice=False)
Returns the choices of a choice field as a list of tuples.
- get_choices_list(return_non_searchables=False)
Returns the choices of a choice field as a list with all its options.
- get_choices_list_dict()
Returns the choices of a choice field as a dictionary with all its options.
- get_comparison_operator_display(*, field=<django.db.models.fields.CharField: comparison_operator>)
- get_data_field_type_display(*, field=<django.db.models.fields.CharField: data_field_type>)
- get_field_type_display(*, field=<django.db.models.fields.PositiveSmallIntegerField: field_type>)
- get_initial_value()
Returns the initial value of a search field. This is used to pre-fill the form with a value.
- get_list_condition_display(*, field=<django.db.models.fields.CharField: list_condition>)
- get_list_keys()
Returns the keys of the list choices.
- help_text
The help text which will be displayed in the form
- initial_value
Initial value of the field
- input_transformation_regex
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_choice_field()
Returns True if the field is a choice field.
- is_multi_field()
Returns True if the field is a choice field.
- list_choices
Comma separated list of choices for dropdowns
- list_condition
Condition for multiple list values
- lower_value
The lower value of a range field
- ndrcoresearchfieldformconfiguration_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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- objects = <django.db.models.manager.Manager object>
- schema_name
If the search fields were created from a schema, this field gets filled out with the schema’s name. This helps to identify fields which were automatically created so they can be overwritten when they are regenerated from a schema
- text_choices
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- upper_value
The upper value of a range field
- use_in_csv_export
Should this field be included in the CSV export?
- used_in_data_lists
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.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- class ndr_core.models.NdrCoreSearchFieldFormConfiguration(*args, **kwargs)
Search fields can be used in forms. In order to place them, they can be configured to fit in a grid with a NdrCoreSearchFieldFormConfiguration.
- exception DoesNotExist
- exception MultipleObjectsReturned
- field_column
The column in the form. Is a value between 1 and 12
- field_row
The row in the form. Starts with 1.
- field_size
The size of the field. Is a value between 1 and 12
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- ndrcoresearchconfiguration_set
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.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- objects = <django.db.models.manager.Manager object>
- search_field
The search field to place in a form
- search_field_id
- class ndr_core.models.NdrCoreSearchStatisticEntry(*args, **kwargs)
Every time a search is executed, a NdrCoreSearchStatisticEntry object is created if the setting ‘statistics_feature’ is set to ‘true’
- exception DoesNotExist
- exception MultipleObjectsReturned
- get_next_by_search_time(*, field=<django.db.models.fields.DateTimeField: search_time>, is_next=True, **kwargs)
- get_previous_by_search_time(*, field=<django.db.models.fields.DateTimeField: search_time>, is_next=False, **kwargs)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- language
Language of the search.
- objects = <django.db.models.manager.Manager object>
- search_config
The API which was queried in the search.
- search_config_id
- search_location
The location the user searched from.
- search_no_results
The number of results which were returned.
- search_query
The actual query which was sent to the API.
- search_term
The search term(s) which have been searched.
- search_time
The time the user searched.
- class ndr_core.models.NdrCoreTranslation(*args, **kwargs)
NdrCoreTranslation is used to translate CharField fields.
- exception DoesNotExist
- exception MultipleObjectsReturned
- field_name
Name of the field to translate.
- get_table_name_display(*, field=<django.db.models.fields.CharField: table_name>)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- language
Language of the translation.
- object_id
ID of the object the field belongs to.
- objects = <django.db.models.manager.Manager object>
- table_name
Name of the table the field belongs to.
- translation
Translation of the field.
- class ndr_core.models.NdrCoreUIElement(*args, **kwargs)
UI Element
- exception DoesNotExist
- exception MultipleObjectsReturned
- class UIElementType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
NDR Core UI Element types.
- ACADEMIC_ABOUT = 'academic_about'
- AUDIO = 'audio'
- BANNER = 'banner'
- CARD = 'card'
- CAROUSEL = 'carousel'
- DATA_OBJECT = 'data_object'
- IFRAME = 'iframe'
- JUMBOTRON = 'jumbotron'
- MANIFEST_VIEWER = 'manifest_viewer'
- SLIDESHOW = 'slides'
- TEAM_GRID = 'team_grid'
- VIDEO = 'video'
- autoplay
Autoplay carousels and slideshows?
- get_absolute_url()
Returns the absolute url of the image.
- get_type_display(*, field=<django.db.models.fields.CharField: type>)
- items()
Returns the items of the UI element, ordered.
- label
Label for display purposes in admin.
- name
Name and primary key of the element. Used as slug for calling element.
- ndrcoreuielementitem_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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- objects = <django.db.models.manager.Manager object>
- show_indicators
Show the indicators for slideshows and carousels? (Applies to: Slideshow, Carousel)
- type
Type of the element. Decides how it is rendered.
- class ndr_core.models.NdrCoreUiElementItem(*args, **kwargs)
UI Element Item. Is part of a UI Element.
- exception DoesNotExist
- exception MultipleObjectsReturned
- belongs_to
The UI Element this item belongs to.
- belongs_to_id
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- manifest_group
The manifest group of the item.
- manifest_group_id
- ndr_image
The image of the item.
- ndr_image_id
- object_id
ID of the object to fetch from the API.
- objects = <django.db.models.manager.Manager object>
- order_idx
The order index of the item.
- provider
Provider type for video embeds and social media widgets.
- result_field
Result field containing the rich_expression to render the data object.
- result_field_id
- rich_text
Rich formatted text content (e.g., for bios, detailed descriptions).
- search_configuration
Search configuration to use for fetching data object.
- search_configuration_id
- text
The text of the item.
- title
The title of the item.
- translatable_fields = ['title', 'text', 'rich_text']
Fields which are translatable for this model.
- translated_rich_text()
Get translated version of rich_text field.
- upload_file
Uploaded file reference for audio players and other file-based elements.
- upload_file_id
- url
The url of the item.
- class ndr_core.models.NdrCoreUiStyle(*args, **kwargs)
A NDR Core page is styled a certain way. Navigation may be on top or to the left, fonts may be different and so on. Each UI Style provides a base.html and (most probably) a css file.
- exception DoesNotExist
- exception MultipleObjectsReturned
- description
Description of the style, highlighting its properties.
- filename
Filename to save the base file and css with (no extension and no path information).
- label
Human readable and descriptive label of the UI style.
- name
Name of the style. Used as identifier.
- objects = <django.db.models.manager.Manager object>
- class ndr_core.models.NdrCoreUpload(*args, **kwargs)
Directory of all uploads.
- exception DoesNotExist
- exception MultipleObjectsReturned
- file
Actual file
- get_file_extension()
Returns the file extension in lowercase.
- get_file_icon_class()
Returns FontAwesome icon class based on file type.
- get_file_size()
Returns file size in bytes.
- get_file_size_display()
Returns human-readable file size.
- get_file_type()
Returns a human-readable file type based on extension.
- 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>
- title
Title of the upload
- ui_element_items
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- class ndr_core.models.NdrCoreUserMessage(*args, **kwargs)
If the contact form is sent, a user message object is created.
- exception DoesNotExist
- exception MultipleObjectsReturned
- get_next_by_message_time(*, field=<django.db.models.fields.DateTimeField: message_time>, is_next=True, **kwargs)
- get_previous_by_message_time(*, field=<django.db.models.fields.DateTimeField: message_time>, is_next=False, **kwargs)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- message_archived
Indicates if the message has been archived.
- message_forwarded
Indicates if the message has been forwarded to a specified e-mail address.
- message_ret_email
The e-mail address of the sender.
- message_subject
The subject of the message.
- message_text
The text of the message.
- message_time
The time the message was sent.
- objects = <django.db.models.manager.Manager object>
- class ndr_core.models.NdrCoreValue(*args, **kwargs)
NdrCore provides a number of ready-to-use components which need to be configured with setting values. This data model stores these setting values. Example: A contact form has a subject field which can be prefilled with a string of choice. This string can be provided by this data model (value_name=’contact_form_default_subject’). The list of values is given and gets loaded from a fixture when the management command ‘init_ndr_core’ is executed. Users can only manipulate the ‘value_value’ of each object.
- exception DoesNotExist
- exception MultipleObjectsReturned
- class ValueType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
NdrCoreValues can be of different types. The type determines how the value is displayed and how it can be manipulated.
- BOOLEAN = 'boolean'
- INTEGER = 'integer'
- LIST = 'list'
- MULTI_LIST = 'multi_list'
- RICH_STRING = 'rich'
- STRING = 'string'
- URL = 'url'
- get_options()
For lists there are options, saved as string in the form: (key1,value1);(key2,value2)
- static get_or_initialize(value_name, init_value=None, init_label=None, init_type=ValueType.STRING)
Returns or creates an NdrCoreValue object.
- get_value()
Returns the valued which is always saved as string as the proper type.
- get_value_type_display(*, field=<django.db.models.fields.CharField: value_type>)
- is_translatable
Indicates if a value can be translated
- is_user_value
Indicates if a value was created by a user
- objects = <django.db.models.manager.Manager object>
- set_value(value)
Sets the value which is always saved as string as the proper type.
- translated_value()
Returns the translated field label for a given language. If no translation exists, the default label is returned.
- value_help_text
This is the help text for a value which explains to users what it is for
- value_label
This is a human readable label for the value (e.g. its title)
- value_name
This is the identifier of a NdrCoreValue. In the source, each value gets loaded by searching for this name
- value_options
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- value_type
The type of the value. This determines how the value is displayed and how it can be manipulated.
- value_value
This is the actual value which can be updated by the user. This value is translatable.
- ndr_core.models.TRANSLATABLE_TABLES = (('ndrcoresearchfield', 'Search Field Table'), ('ndrcoreresultfield', 'Result Field Table'), ('ndrcorepage', 'Page Table'), ('ndrcorevalue', 'Settings Table'), ('ndrcoresearchconfiguration', 'Search Configuration Table'), ('ndrcoreuielementitem', 'UI Element Table'))
Tables which contain translatable fields.
- class ndr_core.models.TranslatableMixin
Mixin which provides methods to translate translatable fields. All text values in the configuration are saved in a primary language. Database fields with translatable values have corresponding entries in the NdrCoreTranslation table.
- save_translation(field_name, object_id, language, translation)
Saves a translation for a given field.
- translatable_fields = []
Fields which are translatable for the model this mixin is used with.
- translated_field(orig_value, field_name, object_id)
Returns the translated field for a given language. If no translation exists, the default value is returned.
- ndr_core.models.delete_image_file_on_delete(sender, instance, **kwargs)
Deletes the image file from filesystem when the NdrCoreImage object is deleted.
- ndr_core.models.delete_old_image_file_on_update(sender, instance, **kwargs)
Deletes the old image file from filesystem when a new one is uploaded.
- ndr_core.models.delete_old_upload_file_on_update(sender, instance, **kwargs)
Deletes the old upload file from filesystem when a new one is uploaded.
- ndr_core.models.delete_upload_file_on_delete(sender, instance, **kwargs)
Deletes the upload file from filesystem when the NdrCoreUpload object is deleted.
- ndr_core.models.get_available_languages()
Returns a list of available languages.