Regions

This package contains only the Region model.

Region

class integreat_cms.cms.models.regions.region.Region(*args, **kwargs)[source]

Bases: AbstractBaseModel

Data model representing region.

Parameters:
  • id (BigAutoField) – Primary key: ID

  • name (CharField) – Name

  • common_id (CharField) –

    Community identification number. Number sequence for identifying politically independent administrative units

    See community identification number and Gemeindeschlüssel (German)

  • slug (SlugField) – URL parameter. Unique string identifier without spaces and special characters. Leave blank to generate unique parameter from name

  • status (CharField) –

    Status

    Manage choices in region_status

  • administrative_division (CharField) –

    Administrative division

    Manage choices in administrative_division. Also see administrative division.

  • aliases (JSONField) – Aliases. E.g. smaller municipalities in that area. If empty, the CMS will try to fill this automatically. Specify as JSON.

  • custom_prefix (CharField) – Custom prefix. Enter parts of the name that should not affect sorting. Use this field only if the prefix is not an available choice in the list of administrative divisions above.

  • events_enabled (BooleanField) – Activate events. Whether or not events are enabled in the region

  • locations_enabled (BooleanField) – Activate locations. Whether or not locations are enabled in the region

  • push_notifications_enabled (BooleanField) – Activate push notifications. Whether or not push notifications are enabled in the region

  • latitude (FloatField) – Latitude. The latitude coordinate of an approximate center of the region

  • longitude (FloatField) – Longitude. The longitude coordinate of an approximate center of the region

  • longitude_min (FloatField) – Minimum longitude. The left boundary of the region

  • latitude_min (FloatField) – Minimum latitude. The bottom boundary of the region

  • longitude_max (FloatField) – Maximum longitude. The right boundary of the region

  • latitude_max (FloatField) – Maximum latitude. The top boundary of the region

  • postal_code (CharField) – Postal code. For districts, enter the postcode of the administrative headquarters.

  • admin_mail (EmailField) – Email address of the administrator

  • timezone (CharField) – Timezone

  • created_date (DateTimeField) – Creation date

  • last_updated (DateTimeField) – Modification date

  • statistics_enabled (BooleanField) – Activate statistics. Whether or not statistics are enabled for the region

  • seo_enabled (BooleanField) – Activate SEO section. Enable possibility to fill meta description for pages, events and locations

  • matomo_id (PositiveSmallIntegerField) – Matomo ID. The Matomo ID of this region. Will be automatically derived from the Matomo access token.

  • matomo_token (CharField) – Matomo authentication token. The secret Matomo access token of the region is used to authenticate in API requests

  • page_permissions_enabled (BooleanField) – Activate page-specific permissions. This allows individual users to be granted the right to edit or publish a specific page.

  • chat_enabled (BooleanField) – Activate author chat. This gives all users of this region access to the cross-regional author chat.

  • administrative_division_included (BooleanField) – Include administrative division into name. Determines whether the administrative division is displayed next to the region name. Sorting is always based on the name, independently from the administrative division.

  • short_urls_enabled (BooleanField) – Activate short urls. Please check the box if you want to use short urls.

  • external_news_enabled (BooleanField) – Enable external news. Enable to display external articles in addition to local news managed by the CMS

  • fallback_translations_enabled (BooleanField) – Show content in default language as fallback. Whether or not events and locations are shown in default language as fallback

  • hix_enabled (BooleanField) – Activate HIX analysis. Allow users of this region to analyze understandability of text content via TextLab API.

  • summ_ai_enabled (BooleanField) – Activate automatic translations via SUMM.AI. Whether automatic translations into Easy German with SUMM.AI are enabled

  • mt_renewal_month (PositiveIntegerField) – Credits renewal date for foreign language translation. Budget usage will be reset on the 1st of the month

  • mt_addon_booked (BooleanField) – Add-on package for foreign languages booked. This makes 1.000.000 translation credits available to the region in addition to the 50.000 free ones.

  • mt_midyear_start_month (PositiveIntegerField) – Budget year start date for foreign language translation. Month from which the add-on package was booked

  • mt_budget_used (PositiveIntegerField) – Used budget

  • machine_translate_pages (PositiveIntegerField) – Pages

  • machine_translate_events (PositiveIntegerField) – Events

  • machine_translate_pois (PositiveIntegerField) – Locations

  • zammad_url (URLField) – Zammad-URL. URL pointing to this region’s Zammad instance. Setting this enables Zammad form offers.

Relationship fields:

Parameters:
  • icon (ForeignKey to MediaFile) – Logo (related name: icon_regions)

  • offers (ManyToManyField to OfferTemplate) – Offers. Integreat offers are extended features apart from pages and events and are usually offered by a third party. In most cases, the url is an external API endpoint which the frontend apps can query and render the results inside the Integreat app. (related name: regions)

Reverse relationships:

Parameters:
exception DoesNotExist[source]

Bases: ObjectDoesNotExist

__init__(*args, **kwargs)[source]
add_note()[source]

Exception.add_note(note) – add a note to the exception

args[source]
silent_variable_failure = True[source]
with_traceback()[source]

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception MultipleObjectsReturned[source]

Bases: MultipleObjectsReturned

__init__(*args, **kwargs)[source]
add_note()[source]

Exception.add_note(note) – add a note to the exception

args[source]
with_traceback()[source]

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

__init__(*args, **kwargs)[source]
active_languages[source]

This property returns a list of all Language objects which have an active LanguageTreeNode which belongs to this region.

Returns:

A list of all active Language instances of this region

async adelete(using=None, keep_parents=False)[source]
admin_mail[source]

Type: EmailField

Email address of the administrator

administrative_division[source]

Type: CharField

Administrative division

Choices:

  • CITY

  • DISTRICT

  • RURAL_DISTRICT

  • REGION

  • CITY_AND_DISTRICT

  • URBAN_DISTRICT

  • GOVERNMENTAL_DISTRICT

  • CITY_STATE

  • AREA_STATE

  • FREE_STATE

  • and 4 more

Manage choices in administrative_division. Also see administrative division.

administrative_division_included[source]

Type: BooleanField

Include administrative division into name. Determines whether the administrative division is displayed next to the region name. Sorting is always based on the name, independently from the administrative division.

aliases[source]

Type: JSONField

Aliases. E.g. smaller municipalities in that area. If empty, the CMS will try to fill this automatically. Specify as JSON.

archived_pages[source]

This property returns a QuerySet of all archived pages and their descendants of this region.

Returns:

A QuerySet of all archived pages of this region

async arefresh_from_db(using=None, fields=None)[source]
async asave(force_insert=False, force_update=False, using=None, update_fields=None)[source]

This function returns the absolute url to the edit form of this region

Returns:

The url

bounding_box[source]

The bounding box of the region

Returns:

A bounding box object

chat_enabled[source]

Type: BooleanField

Activate author chat. This gives all users of this region access to the cross-regional author chat.

classmethod check(**kwargs)[source]
clean()[source]

Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.

clean_fields(exclude=None)[source]

Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.

common_id[source]

Type: CharField

Community identification number. Number sequence for identifying politically independent administrative units

See community identification number and Gemeindeschlüssel (German)

created_date[source]

Type: DateTimeField

Creation date

custom_prefix[source]

Type: CharField

Custom prefix. Enter parts of the name that should not affect sorting. Use this field only if the prefix is not an available choice in the list of administrative divisions above.

date_error_message(lookup_type, field_name, unique_for)[source]
default_language[source]

This property returns the language Language which corresponds to the root LanguageTreeNode of this region.

Returns:

The root Language of a region

delete(using=None, keep_parents=False)[source]
events[source]

Type: Reverse ForeignKey from Event

All events of this region (related name of region)

events_enabled[source]

Type: BooleanField

Activate events. Whether or not events are enabled in the region

property explicitly_archived_ancestors_subquery: PageQuerySet[source]

This property returns a subquery for all explicitly archived ancestors of a given page. Needs to be used as part of another query because in order to resolve OuterRef, e.g. in a Subquery or in Exists.

Returns:

A queryset of the explicitly archived ancestors.

external_news_enabled[source]

Type: BooleanField

Enable external news. Enable to display external articles in addition to local news managed by the CMS

fallback_translations_enabled[source]

Type: BooleanField

Show content in default language as fallback. Whether or not events and locations are shown in default language as fallback

feedback[source]

Type: Reverse ForeignKey from Feedback

All feedback of this region (related name of region)

files[source]

Type: Reverse ForeignKey from MediaFile

All files of this region (related name of region)

classmethod from_db(db, field_names, values)[source]
full_clean(exclude=None, validate_unique=True, validate_constraints=True)[source]

Call clean_fields(), clean(), validate_unique(), and validate_constraints() on the model. Raise a ValidationError for any errors that occur.

full_name[source]

This property returns the full name of a region including its administrative division

Returns:

The full name of the region

get_administrative_division_display(*, field=<django.db.models.CharField: administrative_division>)[source]

Shows the label of the administrative_division. See get_FOO_display() for more information.

get_constraints()[source]
get_deferred_fields()[source]

Return a set containing names of deferred fields for this instance.

get_language_or_404(language_slug: str, only_active: bool = False, only_visible: bool = False) Language[source]

This class method returns the requested language of this region with optional filters active and visible

Parameters:
  • language_slug (str) – The slug of the requested language

  • only_active (bool) – Whether to return only active languages

  • only_visible (bool) – Whether to return only visible languages

Raises:

Http404 – When no language with the given slug exists for this region and this filters

Returns:

The requested Language of this region

Return type:

Language

get_machine_translate_events_display(*, field=<django.db.models.PositiveIntegerField: machine_translate_events>)[source]

Shows the label of the machine_translate_events. See get_FOO_display() for more information.

get_machine_translate_pages_display(*, field=<django.db.models.PositiveIntegerField: machine_translate_pages>)[source]

Shows the label of the machine_translate_pages. See get_FOO_display() for more information.

get_machine_translate_pois_display(*, field=<django.db.models.PositiveIntegerField: machine_translate_pois>)[source]

Shows the label of the machine_translate_pois. See get_FOO_display() for more information.

classmethod get_model_name_plural() str[source]

Get the plural representation of this model name

Returns:

The plural model name

Return type:

str

get_mt_midyear_start_month_display(*, field=<django.db.models.PositiveIntegerField: mt_midyear_start_month>)[source]

Shows the label of the mt_midyear_start_month. See get_FOO_display() for more information.

get_mt_renewal_month_display(*, field=<django.db.models.PositiveIntegerField: mt_renewal_month>)[source]

Shows the label of the mt_renewal_month. See get_FOO_display() for more information.

get_next_by_created_date(*, field=<django.db.models.DateTimeField: created_date>, is_next=True, **kwargs)[source]

Finds next instance based on created_date. See get_next_by_FOO() for more information.

get_next_by_last_updated(*, field=<django.db.models.DateTimeField: last_updated>, is_next=True, **kwargs)[source]

Finds next instance based on last_updated. See get_next_by_FOO() for more information.

get_pages(archived: bool = False, prefetch_translations: bool = False, prefetch_public_translations: bool = False, annotate_language_tree: bool = False) PageQuerySet[source]

This method returns either all archived or all non-archived pages of this region. To retrieve all pages independently of their archived-state, use the reverse foreign key pages.

Parameters:
  • archived (bool) – Whether or not only archived pages should be returned (default: False)

  • prefetch_translations (bool) – Whether the latest translations for each language should be prefetched (default: False)

  • prefetch_public_translations (bool) – Whether the latest public translations for each language should be prefetched (default: False)

  • annotate_language_tree (bool) – Whether the pages should be annotated with the region’s language tree (default: False)

Returns:

Either the archived or the non-archived pages of this region

Return type:

PageQuerySet

get_previous_by_created_date(*, field=<django.db.models.DateTimeField: created_date>, is_next=False, **kwargs)[source]

Finds previous instance based on created_date. See get_previous_by_FOO() for more information.

get_previous_by_last_updated(*, field=<django.db.models.DateTimeField: last_updated>, is_next=False, **kwargs)[source]

Finds previous instance based on last_updated. See get_previous_by_FOO() for more information.

get_repr() str[source]

This overwrites the default Django __repr__() method which would return <Region: Region object (id)>. It is used for logging.

Returns:

The canonical string representation of the region

Return type:

str

get_root_pages() PageQuerySet[source]

This method returns all root pages of this region.

Returns:

This region’s root pages

Return type:

PageQuerySet

get_source_language(language_slug: str) Language | None[source]

This property returns this region’s source language of a given language object

Parameters:

language_slug (str) – The slug of the requested language

Returns:

The source language of the given language in this region

Return type:

Language | None

get_status_display(*, field=<django.db.models.CharField: status>)[source]

Shows the label of the status. See get_FOO_display() for more information.

has_bounding_box[source]

Whether the region has an individual bounding box

Returns:

Whether all required coordinates for the bounding box are set

hix_enabled[source]

Type: BooleanField

Activate HIX analysis. Allow users of this region to analyze understandability of text content via TextLab API.

icon[source]

Type: ForeignKey to MediaFile

Logo (related name: icon_regions)

icon_id[source]

Internal field, use icon instead.

id[source]

Type: BigAutoField

Primary key: ID

imprint[source]

This property returns this region’s imprint

Returns:

The imprint of this region

imprints[source]

Type: Reverse ForeignKey from ImprintPage

All imprints of this region (related name of region)

language_node_by_id[source]

This property returns this region’s language tree nodes indexed by ids

Returns:

A mapping from language tree node ids to their language tree nodes in this region

language_node_by_slug[source]

This property returns this region’s language tree nodes indexed by slugs

Returns:

A mapping from language slugs to their language tree nodes in this region

language_tree[source]

This property returns a list of all LanguageTreeNode objects of this region.

Returns:

A list of all language tree nodes of this region

language_tree_nodes[source]

Type: Reverse ForeignKey from LanguageTreeNode

All language tree nodes of this region (related name of region)

language_tree_root[source]

This property returns a the root node of the region’s language tree

Returns:

The region’s language root node

languages[source]

This property returns a list of all Language objects which have a LanguageTreeNode which belongs to this region.

Returns:

A list of all Language instances of this region

last_content_update[source]

Find the latest date at which any content of the region has been modified.

Returns:

the last content update date

last_updated[source]

Type: DateTimeField

Modification date

latitude[source]

Type: FloatField

Latitude. The latitude coordinate of an approximate center of the region

latitude_max[source]

Type: FloatField

Maximum latitude. The top boundary of the region

latitude_min[source]

Type: FloatField

Minimum latitude. The bottom boundary of the region

locations_enabled[source]

Type: BooleanField

Activate locations. Whether or not locations are enabled in the region

longitude[source]

Type: FloatField

Longitude. The longitude coordinate of an approximate center of the region

longitude_max[source]

Type: FloatField

Maximum longitude. The right boundary of the region

longitude_min[source]

Type: FloatField

Minimum longitude. The left boundary of the region

machine_translate_events[source]

Type: PositiveIntegerField

Events

Choices:

  • 0

  • 1

  • 2

machine_translate_pages[source]

Type: PositiveIntegerField

Pages

Choices:

  • 0

  • 1

  • 2

machine_translate_pois[source]

Type: PositiveIntegerField

Locations

Choices:

  • 0

  • 1

  • 2

matomo_id[source]

Type: PositiveSmallIntegerField

Matomo ID. The Matomo ID of this region. Will be automatically derived from the Matomo access token.

matomo_token[source]

Type: CharField

Matomo authentication token. The secret Matomo access token of the region is used to authenticate in API requests

media_directories[source]

Type: Reverse ForeignKey from Directory

All media directories of this region (related name of region)

mt_addon_booked[source]

Type: BooleanField

Add-on package for foreign languages booked. This makes 1.000.000 translation credits available to the region in addition to the 50.000 free ones.

property mt_budget: int[source]

Calculate the maximum translation credit budget (number of words)

Returns:

The region’s total MT budget

property mt_budget_remaining: int[source]

Calculate the remaining translation credit budget (number of words)

Returns:

The region’s remaining MT budget

mt_budget_used[source]

Type: PositiveIntegerField

Used budget

mt_midyear_start_month[source]

Type: PositiveIntegerField

Budget year start date for foreign language translation. Month from which the add-on package was booked

Choices:

  • 0

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • and 2 more

mt_renewal_month[source]

Type: PositiveIntegerField

Credits renewal date for foreign language translation. Budget usage will be reset on the 1st of the month

Choices:

  • 0

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • and 2 more

name[source]

Type: CharField

Name

non_archived_pages[source]

This property returns a QuerySet of all non-archived pages of this region. A page is considered as “non-archived” if its explicitly_archived property is False and all the page’s ancestors are not archived as well.

Returns:

A QuerySet of all non-archived pages of this region

objects = <integreat_cms.cms.models.regions.region.RegionManager object>[source]

Django manager to access the ORM Use Region.objects.all() to fetch all objects.

Custom model manager RegionManager for region objects

offers[source]

Type: ManyToManyField to OfferTemplate

Offers. Integreat offers are extended features apart from pages and events and are usually offered by a third party. In most cases, the url is an external API endpoint which the frontend apps can query and render the results inside the Integreat app. (related name: regions)

organizations[source]

Type: Reverse ForeignKey from Organization

All organizations of this region (related name of region)

page_permissions_enabled[source]

Type: BooleanField

Activate page-specific permissions. This allows individual users to be granted the right to edit or publish a specific page.

pages[source]

Type: Reverse ForeignKey from Page

All pages of this region (related name of region)

property pk[source]
pois[source]

Type: Reverse ForeignKey from POI

All pois of this region (related name of region)

postal_code[source]

Type: CharField

Postal code. For districts, enter the postcode of the administrative headquarters.

prefix[source]

This property returns the administrative division of a region if it’s included in the name. If this region has no default language, this property returns an empty string

Returns:

The prefix of the region

prepare_database_save(field)[source]
push_notifications[source]

Type: Reverse ManyToManyField from PushNotification

All push notifications of this region (related name of regions)

push_notifications_enabled[source]

Type: BooleanField

Activate push notifications. Whether or not push notifications are enabled in the region

refresh_from_db(using=None, fields=None)[source]

Reload field values from the database.

By default, the reloading happens from the database this instance was loaded from, or by the read router if this instance wasn’t loaded from any database. The using parameter will override the default.

Fields can be used to specify which fields to reload. The fields should be an iterable of field attnames. If fields is None, then all non-deferred fields are reloaded.

When accessing deferred fields of an instance, the deferred loading of the field will call this method.

region_users[source]

This property returns a QuerySet of all User objects which belong to this region and are neither superusers nor staff.

Returns:

A QuerySet of all User object instances of a region

save(force_insert=False, force_update=False, using=None, update_fields=None)[source]

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

save_base(raw=False, force_insert=False, force_update=False, using=None, update_fields=None)[source]

Handle the parts of saving which should be done only once per save, yet need to be done in raw saves, too. This includes some sanity checks and signal sending.

The ‘raw’ argument is telling save_base not to save any parent models and not to do any changes to the values before save. This is used by fixture loading.

classmethod search(query: str) QuerySet[Region][source]

Searches for all regions which match the given query in their name. :param query: The query string used for filtering the regions :return: A query for all matching objects

Parameters:

query (str) –

Return type:

QuerySet[Region]

seo_enabled[source]

Type: BooleanField

Activate SEO section. Enable possibility to fill meta description for pages, events and locations

serializable_value(field_name)[source]

Return the value of the field name for this instance. If the field is a foreign key, return the id value instead of the object. If there’s no Field object with this name on the model, return the model attribute’s value.

Used to serialize a field’s value (in the serializer, or form output, for example). Normally, you would just access the attribute directly and not use this method.

short_urls_enabled[source]

Type: BooleanField

Activate short urls. Please check the box if you want to use short urls.

slug[source]

Type: SlugField

URL parameter. Unique string identifier without spaces and special characters. Leave blank to generate unique parameter from name

statistics[source]

This property returns the MatomoApiClient of the current region.

Returns:

The statistics manager

statistics_enabled[source]

Type: BooleanField

Activate statistics. Whether or not statistics are enabled for the region

status[source]

Type: CharField

Status

Choices:

  • ACTIVE

  • HIDDEN

  • ARCHIVED

Manage choices in region_status

summ_ai_enabled[source]

Type: BooleanField

Activate automatic translations via SUMM.AI. Whether automatic translations into Easy German with SUMM.AI are enabled

timezone[source]

Type: CharField

Timezone

unique_error_message(model_class, unique_check)[source]
users[source]

Type: Reverse ManyToManyField from User

All users of this region (related name of regions)

validate_constraints(exclude=None)[source]
validate_unique(exclude=None)[source]

Check unique constraints on the model and raise ValidationError if any failed.

visible_languages[source]

This property returns a list of all Language objects which have an active & visible LanguageTreeNode which belongs to this region.

Returns:

A list of all active & visible Language instances of this region

zammad_url[source]

Type: URLField

Zammad-URL. URL pointing to this region’s Zammad instance. Setting this enables Zammad form offers.

class integreat_cms.cms.models.regions.region.RegionManager(*args, **kwargs)[source]

Bases: Manager

This manager annotates each region object with its language tree root node. This is done because it is required to calculate the region’s default_language which is called in full_name.

__init__()[source]
aaggregate(*args, **kwargs)[source]
abulk_create(objs, batch_size=None, ignore_conflicts=False, update_conflicts=False, update_fields=None, unique_fields=None)[source]
abulk_update(objs, fields, batch_size=None)[source]
acontains(obj)[source]
acount()[source]
acreate(**kwargs)[source]
aearliest(*fields)[source]
aexists()[source]
aexplain(*, format=None, **options)[source]
afirst()[source]
aget(*args, **kwargs)[source]
aget_or_create(defaults=None, **kwargs)[source]
aggregate(*args, **kwargs)[source]

Return a dictionary containing the calculations (aggregation) over the current queryset.

If args is present the expression is passed as a kwarg using the Aggregate object’s default alias.

ain_bulk(id_list=None, *, field_name='pk')[source]
aiterator(chunk_size=2000)[source]

An asynchronous iterator over the results from applying this QuerySet to the database.

alast()[source]
alatest(*fields)[source]
alias(*args, **kwargs)[source]

Return a query set with added aliases for extra data or aggregations.

all()[source]
annotate(*args, **kwargs)[source]

Return a query set in which the returned objects have been annotated with extra data or aggregations.

aupdate(**kwargs)[source]
aupdate_or_create(defaults=None, **kwargs)[source]
auto_created = False[source]
bulk_create(objs, batch_size=None, ignore_conflicts=False, update_conflicts=False, update_fields=None, unique_fields=None)[source]

Insert each of the instances into the database. Do not call save() on each of the instances, do not send any pre/post_save signals, and do not set the primary key attribute if it is an autoincrement field (except if features.can_return_rows_from_bulk_insert=True). Multi-table models are not supported.

bulk_update(objs, fields, batch_size=None)[source]

Update the given fields in each of the given objects in the database.

check(**kwargs)[source]
complex_filter(filter_obj)[source]

Return a new QuerySet instance with filter_obj added to the filters.

filter_obj can be a Q object or a dictionary of keyword lookup arguments.

This exists to support framework features such as ‘limit_choices_to’, and usually it will be more natural to use other methods.

contains(obj)[source]

Return True if the QuerySet contains the provided obj, False otherwise.

contribute_to_class(cls, name)[source]
count()[source]

Perform a SELECT COUNT() and return the number of records as an integer.

If the QuerySet is already fully cached, return the length of the cached results set to avoid multiple SELECT COUNT(*) calls.

create(**kwargs)[source]

Create a new object with the given kwargs, saving it to the database and returning the created object.

creation_counter = 46[source]
dates(field_name, kind, order='ASC')[source]

Return a list of date objects representing all available dates for the given field_name, scoped to ‘kind’.

datetimes(field_name, kind, order='ASC', tzinfo=None, is_dst=<object object>)[source]

Return a list of datetime objects representing all available datetimes for the given field_name, scoped to ‘kind’.

property db[source]
db_manager(using=None, hints=None)[source]
deconstruct()[source]

Return a 5-tuple of the form (as_manager (True), manager_class, queryset_class, args, kwargs).

Raise a ValueError if the manager is dynamically generated.

defer(*fields)[source]

Defer the loading of data for certain fields until they are accessed. Add the set of deferred fields to any existing set of deferred fields. The only exception to this is if None is passed in as the only parameter, in which case removal all deferrals.

difference(*other_qs)[source]
distinct(*field_names)[source]

Return a new QuerySet instance that will select only distinct results.

earliest(*fields)[source]
exclude(*args, **kwargs)[source]

Return a new QuerySet instance with NOT (args) ANDed to the existing set.

exists()[source]

Return True if the QuerySet would have any results, False otherwise.

explain(*, format=None, **options)[source]

Runs an EXPLAIN on the SQL query this QuerySet would perform, and returns the results.

extra(select=None, where=None, params=None, tables=None, order_by=None, select_params=None)[source]

Add extra SQL fragments to the query.

filter(*args, **kwargs)[source]

Return a new QuerySet instance with the args ANDed to the existing set.

first()[source]

Return the first object of a query or None if no match is found.

classmethod from_queryset(queryset_class, class_name=None)[source]
get(*args, **kwargs)[source]

Perform the query and return a single object matching the given keyword arguments.

get_or_create(defaults=None, **kwargs)[source]

Look up an object with the given kwargs, creating one if necessary. Return a tuple of (object, created), where created is a boolean specifying whether an object was created.

get_queryset() QuerySet[source]

Get the queryset of regions including the custom attribute language_tree_root which contains the root node of the region’s language tree.

Returns:

The queryset of regions

Return type:

QuerySet

in_bulk(id_list=None, *, field_name='pk')[source]

Return a dictionary mapping each of the given IDs to the object with that ID. If id_list isn’t provided, evaluate the entire QuerySet.

intersection(*other_qs)[source]
iterator(chunk_size=None)[source]

An iterator over the results from applying this QuerySet to the database. chunk_size must be provided for QuerySets that prefetch related objects. Otherwise, a default chunk_size of 2000 is supplied.

last()[source]

Return the last object of a query or None if no match is found.

latest(*fields)[source]

Return the latest object according to fields (if given) or by the model’s Meta.get_latest_by.

none()[source]

Return an empty QuerySet.

only(*fields)[source]

Essentially, the opposite of defer(). Only the fields passed into this method and that are not already specified as deferred are loaded immediately when the queryset is evaluated.

order_by(*field_names)[source]

Return a new QuerySet instance with the ordering changed.

Return a new QuerySet instance that will prefetch the specified Many-To-One and Many-To-Many related objects when the QuerySet is evaluated.

When prefetch_related() is called more than once, append to the list of prefetch lookups. If prefetch_related(None) is called, clear the list.

raw(raw_query, params=(), translations=None, using=None)[source]
reverse()[source]

Reverse the ordering of the QuerySet.

select_for_update(nowait=False, skip_locked=False, of=(), no_key=False)[source]

Return a new QuerySet instance that will select objects with a FOR UPDATE lock.

Return a new QuerySet instance that will select related objects.

If fields are specified, they must be ForeignKey fields and only those related objects are included in the selection.

If select_related(None) is called, clear the list.

union(*other_qs, all=False)[source]
update(**kwargs)[source]

Update all elements in the current QuerySet, setting all the given fields to the appropriate values.

update_or_create(defaults=None, **kwargs)[source]

Look up an object with the given kwargs, updating one with defaults if it exists, otherwise create a new one. Return a tuple (object, created), where created is a boolean specifying whether an object was created.

use_in_migrations = False[source]

If set to True the manager will be serialized into migrations and will thus be available in e.g. RunPython operations.

using(alias)[source]

Select which database this QuerySet should execute against.

values(*fields, **expressions)[source]
values_list(*fields, flat=False, named=False)[source]
integreat_cms.cms.models.regions.region.format_mt_help_text(help_text: Promise) str[source]

Helper function to lazily format help text with number separators

Parameters:

help_text (Promise) – MT field help text to format

Returns:

formatted help text

Return type:

str