POIs

This package contains both data models related to points of interest (POIs): POI and POITranslation. POIs can be used to store information which is relevant for one specific location, e.g. a place where local authorities offer a public service. They can also be used as location for an Event.

POI

class integreat_cms.cms.models.pois.poi.POI(*args, **kwargs)[source]

Bases: AbstractContentModel

Data model representing a point of interest (POI). It contains all relevant data about its exact position, including coordinates.

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

  • created_date (DateTimeField) – Creation date

  • address (CharField) – Street and house number

  • postcode (CharField) – Postal code

  • city (CharField) – City

  • country (CharField) – Country

  • latitude (FloatField) – Latitude. The latitude coordinate

  • longitude (FloatField) – Longitude. The longitude coordinate

  • location_on_map (BooleanField) – Show this location on map. Tick if you want to show this location on map

  • archived (BooleanField) – Archived. Whether or not the location is read-only and hidden in the API.

  • website (URLField) – Website

  • email (EmailField) – Email address

  • phone_number (CharField) – Phone number

  • temporarily_closed (BooleanField) – Temporarily closed. Whether or not the location is temporarily closed. The opening hours remain and are only hidden.

  • appointment_url (URLField) – Appointment link. Link to an external website where an appointment for this location can be made.

  • opening_hours (JSONField) – Opening hours

  • barrier_free (BooleanField) – Barrier free. Indicate if the location is barrier free.

Relationship fields:

Parameters:

Reverse relationships:

Parameters:
  • translations (Reverse ForeignKey from POITranslation) – All translations of this location (related name of poi)

  • contacts (Reverse ForeignKey from Contact) – All contacts of this location (related name of location)

  • events (Reverse ForeignKey from Event) – All events of this location (related name of location)

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]
address[source]

Type: CharField

Street and house number

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

Type: URLField

Appointment link. Link to an external website where an appointment for this location can be made.

archive() bool[source]

Archives the poi and removes all links of this poi from the linkchecker

Return type:

bool

archived[source]

Type: BooleanField

Archived. Whether or not the location is read-only and hidden in the API.

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

This method returns an iterator over all available translations, respecting the fallback_translations_enabled setting.

Returns:

An iterator over all translations

Return type:

Iterator[Any]

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

Returns:

The url

backend_translation[source]

This function returns the translation of this content object in the current backend language.

Returns:

The backend translation of a content object

barrier_free[source]

Type: BooleanField

Barrier free. Indicate if the location is barrier free.

best_translation[source]

This function returns the translation of this content object in the current backend language and if it doesn’t exist, it provides a fallback to the translation in the region’s default language.

Returns:

The “best” translation of a content object for displaying in the backend

category[source]

Type: ForeignKey to POICategory

Category (related name: pois)

category_id[source]

Internal field, use category instead.

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

Type: CharField

City

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.

contacts[source]

Type: Reverse ForeignKey from Contact

All contacts of this location (related name of location)

country[source]

Type: CharField

Country

created_date[source]

Type: DateTimeField

Creation date

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

This function returns the public translation of this content object in the region’s default language.

Returns:

The default translation of a content object

default_translation[source]

This function returns the translation of this content object in the region’s default language. Since a content object can only be created by creating a translation in the default language, this is guaranteed to return a object translation (Exception: When the default language tree node is changed to another language after the page has been created, the default translation might not exist).

Returns:

The default translation of a content object

delete(*args: list, **kwargs: dict) bool[source]

Deletes the poi :param *args: The supplied arguments :param **kwargs: The supplied keyword arguments

Parameters:
Return type:

bool

property edit_lock_key: tuple[str | int | None, str][source]

This property returns the key that is used to lock this specific content object

Returns:

A tuple of the id of this object and the classname

email[source]

Type: EmailField

Email address

events[source]

Type: Reverse ForeignKey from Event

All events of this location (related name of location)

property fallback_translations_enabled: bool[source]

Whether translations should be returned in the default language if they do not exist

Returns:

Whether fallback translations are enabled

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.

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

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

get_locking_user() Any | None[source]

This method returns the user that is currently locking this content object.

Returns:

The user

Return type:

Any | None

get_major_public_translation(language_slug: str) AbstractContentTranslation | None[source]

This function retrieves the newest major public translation of a content object.

Parameters:

language_slug (str) – The slug of the requested Language

Returns:

The public translation of a content object

Return type:

AbstractContentTranslation | None

get_major_translation(language_slug: str) AbstractContentTranslation | None[source]

This function retrieves the newest major translation of a content object.

Parameters:

language_slug (str) – The slug of the requested Language

Returns:

The public translation of a content object

Return type:

AbstractContentTranslation | None

classmethod get_model_name_plural() str[source]

Get the plural representation of this model name

Returns:

The plural model name

Return type:

str

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_prefetched_translations_by_language_slug(attr: str = 'prefetched_translations', **filters: Any) dict[str, AbstractContentTranslation][source]

This method returns a mapping from language slugs to their latest translations of this object

Parameters:
  • attr (str) – Which attribute should be tried to get the prefetched translations [optional, defaults to "prefetched_translations"]

  • **filters (Any) – Additional filters to be applied on the translations (e.g. by status)

Returns:

The prefetched translations by language slug

Return type:

dict[str, AbstractContentTranslation]

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_public_or_draft_translation(language_slug: str) AbstractContentTranslation | None[source]

This function retrieves the newest public or draft translation of a content object.

Parameters:

language_slug (str) – The slug of the requested Language

Returns:

The public translation of a content object

Return type:

AbstractContentTranslation | None

get_public_translation(language_slug: str) AbstractContentTranslation | None[source]

This function retrieves the newest public translation of a content object.

Parameters:

language_slug (str) – The slug of the requested Language

Returns:

The public translation of a content object

Return type:

AbstractContentTranslation | None

get_repr() str[source]

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

Returns:

The canonical string representation of the content object

Return type:

str

get_translation(language_slug: str) AbstractContentTranslation | None[source]

This function uses the reverse foreign key self.translations to get all translations of self and filters them to the requested Language slug.

Parameters:

language_slug (str) – The slug of the desired Language

Returns:

The translation in the requested Language or None if no translation exists

Return type:

AbstractContentTranslation | None

static get_translation_model() ModelBase[source]

Returns the translation model of this content model

Returns:

The class of translations

Return type:

ModelBase

get_translation_state(language_slug: str) str[source]

This function returns the current state of a translation in the given language.

Parameters:

language_slug (str) – The slug of the desired Language

Returns:

A string describing the state of the translation, one of CHOICES

Return type:

str

hix_ignore: bool = False[source]

Whether the HIX value is ignored (this is False by default if not overwritten by a submodel)

icon[source]

Type: ForeignKey to MediaFile

Icon. The best results are achieved with images in 16:9 aspect ratio. (related name: pois)

icon_id[source]

Internal field, use icon instead.

id[source]

Type: BigAutoField

Primary key: ID

invalidate_cached_translations() None[source]

Delete all cached translations and query them from the database again when they are accessed next time.

This is helpful when new translations have been created and the content model should be reused.

Return type:

None

property is_used: bool[source]
Returns:

whether this poi is used by another model

languages[source]

This property returns a list of all Language objects, to which a translation exists.

Returns:

The existing languages of this content object

latitude[source]

Type: FloatField

Latitude. The latitude coordinate

location_on_map[source]

Type: BooleanField

Show this location on map. Tick if you want to show this location on map

longitude[source]

Type: FloatField

Longitude. The longitude coordinate

objects = <django.db.models.manager.ManagerFromContentQuerySet object>[source]

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

Custom model manager for content objects

opening_hours[source]

Type: JSONField

Opening hours

organization[source]

Type: ForeignKey to Organization

Organization. Specify which organization operates this location. (related name: pois)

organization_id[source]

Internal field, use organization instead.

phone_number[source]

Type: CharField

Phone number

property pk[source]
postcode[source]

Type: CharField

Postal code

prefetched_major_public_translations_by_language_slug[source]

This method returns a mapping from language slugs to their major public translations of this object

Returns:

The object translation in the requested Language or None if no translation exists

prefetched_major_translations_by_language_slug[source]

This method returns a mapping from language slugs to their major translations of this object

Returns:

The object translation in the requested Language or None if no translation exists

prefetched_public_or_draft_translations_by_language_slug[source]

This method returns a mapping from language slugs to their public translations of this object

Returns:

The object translation in the requested Language or None if no translation exists

prefetched_public_translations_by_language_slug[source]

This method returns a mapping from language slugs to their public translations of this object

Returns:

The object translation in the requested Language or None if no translation exists

prefetched_translations_by_language_slug[source]

This method returns a mapping from language slugs to their latest translations of this object

Returns:

The prefetched translations by language slug

prepare_database_save(field)[source]
public_languages[source]

This property returns a list of all Language objects, to which a public translation exists and which are visible in this region.

Returns:

The existing languages of this content object

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[source]

Type: ForeignKey to Region

Region (related name: pois)

region_id[source]

Internal field, use region instead.

restore() None[source]

Restores the poi and adds all links of this poi back

Return type:

None

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.

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.

temporarily_closed[source]

Type: BooleanField

Temporarily closed. Whether or not the location is temporarily closed. The opening hours remain and are only hidden.

translation_states[source]

This property calculates all translations states of the object

Returns:

A dictionary containing each language as key and the given translation state as value

translations[source]

Type: Reverse ForeignKey from POITranslation

All translations of this location (related name of poi)

unique_error_message(model_class, unique_check)[source]
validate_constraints(exclude=None)[source]
validate_unique(exclude=None)[source]

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

website[source]

Type: URLField

Website

integreat_cms.cms.models.pois.poi.get_default_opening_hours() list[dict[str, Any]][source]

Return the default opening hours

Returns:

The default opening hours

Return type:

list[dict[str, Any]]

POI Translation

class integreat_cms.cms.models.pois.poi_translation.POITranslation(*args, **kwargs)[source]

Bases: AbstractContentTranslation

Data model representing a POI translation

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

  • title (TruncatingCharField) – Name of the location

  • slug (SlugField) – Link to the location. String identifier without spaces and special characters. Unique per region and language. Leave blank to generate unique parameter from title.

  • status (CharField) – Status

  • content (TextField) – Description

  • currently_in_translation (BooleanField) – Currently in translation. Flag to indicate a translation is being updated by an external translator

  • machine_translated (BooleanField) – Machine translated. Flag to indicate whether a translations is machine translated

  • version (PositiveIntegerField) – Revision

  • minor_edit (BooleanField) – Minor edit. Tick if this change does not require an update of translations in other languages.

  • last_updated (DateTimeField) – Modification date

  • automatic_translation (BooleanField) – Automatic translation. Tick if updating this content should automatically refresh or create its translations.

  • meta_description (CharField) – Meta description. Describe the location in one or two short sentences. This text will be displayed in the Google search results below the title.

Relationship fields:

Parameters:

Reverse relationships:

Parameters:

feedback (Reverse ForeignKey from POIFeedback) – All feedback of this location translation (related name of poi_translation)

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]
async adelete(using=None, keep_parents=False)[source]
all_versions[source]

This property returns all versions of this translation’s page in its language

Returns:

All versions of this translation

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

Type: BooleanField

Automatic translation. Tick if updating this content should automatically refresh or create its translations.

available_languages_dict[source]

This property checks in which Language the content is translated apart from self.language It only returns languages which have a public translation, so drafts are not included here. The returned dict has the following format:

{
    available_translation.language.slug: {
        'id': available_translation.id,
        'url': available_translation.permalink
        'path': available_translation.path
    },
    ...
}
Returns:

A dictionary containing the available languages of a content translation

This function returns the absolute url to the editor for this translation

Returns:

The url

Generates the base link which is the whole url without slug

For information about the components of such an url, see get_absolute_url()

Returns:

the base link of the content

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.

cleanup_autosaves() None[source]

Delete all AUTO_SAVE translations older than the second last manual save and renumber all affected versions to be continuous.

Return type:

None

content[source]

Type: TextField

Description

create_new_version_copy(user: User | None = None) AbstractContentTranslation[source]

Create a new version by copying

Parameters:

user (User | None)

Return type:

AbstractContentTranslation

creator[source]

Type: ForeignKey to User

Creator (related name: poi_translations)

creator_id[source]

Internal field, use creator instead.

currently_in_translation[source]

Type: BooleanField

Currently in translation. Flag to indicate a translation is being updated by an external translator

date_error_message(lookup_type, field_name, unique_for)[source]
static default_icon() str | None[source]
Returns:

The default icon that should be used for this content translation type, or None for no icon

Return type:

str | None

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

Type: Reverse ForeignKey from POIFeedback

All feedback of this location translation (related name of poi_translation)

static foreign_field() Literal['poi'][source]

Returns the string “poi” which ist the field name of the reference to the poi which the translation belongs to

Returns:

The foreign field name

Return type:

Literal[‘poi’]

foreign_object[source]

This property is an alias of the POI foreign key and is needed to generalize the slug_utils for all content types

Returns:

The POI to which the translation belongs

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_url[source]

This property returns the full url of this content translation object

Returns:

The full url

get_absolute_url() str[source]

Generates the absolute url of the content translation object

Here is an example for demonstrating the components of a page url:

https://integreat.app/augsburg/en/welcome/city-map/attractions/
|-------------------------------------------------------------|    full_url
                     |----------------------------------------|    get_absolute_url()
|-------------------------------------------------|                base_link
                     |----------------------------|                url_prefix
                                 |----------------|                url_infix
                                                  |-----------|    slug

Here is an example for demonstrating the components of an event url:

https://integreat.app/augsburg/en/events/test-event/
|--------------------------------------------------|    full_url
                     |-----------------------------|    get_absolute_url()
|---------------------------------------|               base_link
                     |------------------|               url_prefix
                                 |------|               url_infix
                                        |----------|    slug
Returns:

The absolute url

Return type:

str

get_all_used_slugs() Iterable[str][source]
Returns:

All slugs that have been used by at least on version of this translation

Return type:

Iterable[str]

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

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

classmethod get_model_name_plural() str[source]

Get the plural representation of this model name

Returns:

The plural model name

Return type:

str

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_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. It is used for logging.

Returns:

The canonical string representation of the content translation

Return type:

str

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

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

hix_enabled[source]

This function returns whether the HIX API is enabled for this instance

Returns:

Whether HIX is enabled

hix_ignore[source]

Whether this translation is ignored for HIX calculation

Returns:

Wether the HIX value is ignored

hix_score = None[source]

The HIX score is None if not overwritten by a submodel

hix_sufficient_for_mt[source]

Whether this translation has a sufficient HIX value for machine translations. If it is None, machine translations are allowed by default.

Returns:

Whether the HIX value is sufficient for MT

id[source]

Type: BigAutoField

Primary key: ID

is_outdated[source]

This property checks whether a translation is outdated and thus needs a new revision of the content. This happens, when the source translation is updated and the update is no minor_edit.

  • If the translation is currently being translated, it is considered not outdated.

  • If the translation’s language is the region’s default language, it is defined to be never outdated.

  • If the translation’s source translation is already outdated, then the translation itself also is.

  • If neither the translation nor its source translation have a latest major public translation, it is defined as not outdated.

  • If neither the translation nor its source translation have a latest major public translation, it is defined as not outdated.

Otherwise, the outdated flag is calculated by comparing the last_updated-field of the translation and its source translation.

Returns:

Flag to indicate whether the translation is outdated

is_up_to_date[source]

This property checks whether a translation is up to date. A translation is considered up to date when it is either explicitly set to up-to-date, or has been machine-translated.

Returns:

Flag which indicates whether a translation is up to date

language[source]

Type: ForeignKey to Language

Language (related name: poi_translations)

language_id[source]

Internal field, use language instead.

last_updated[source]

Type: DateTimeField

Modification date

latest_version[source]

This property is a link to the most recent version of this translation.

Returns:

The latest revision of the translation

This property returns the html that should be used as a title for a link to this translation

Returns:

The link content

Type: Reverse GenericRelation from POITranslation

All poi translation of this link (related name of links)

machine_translated[source]

Type: BooleanField

Machine translated. Flag to indicate whether a translations is machine translated

major_public_source_translation[source]

This property returns the latest major public version of the translation which was used to create the self translation. It derives this information from the Region’s root LanguageTreeNode.

Returns:

The content translation in the source Language (None if the translation is in the Region’s default Language)

major_public_version[source]

This property is a link to the most recent major public version of this translation. This is used when translations, which are derived from this translation, check whether they are up to date.

Returns:

The latest major public revision of the translation

major_source_translation[source]

This property returns the latest major version of the translation which was used to create the self translation. It derives this information from the Region’s root LanguageTreeNode.

Returns:

The content translation in the source Language (None if the translation is in the Region’s default Language)

major_version[source]

This property is a link to the most recent major version of this translation. This is used when translations, which are derived from this translation, check whether they are up to date.

Returns:

The latest major public revision of the translation

meta_description[source]

Type: CharField

Meta description. Describe the location in one or two short sentences. This text will be displayed in the Google search results below the title.

minor_edit[source]

Type: BooleanField

Minor edit. Tick if this change does not require an update of translations in other languages.

objects = <django.db.models.Manager object>[source]
path() str[source]

This method returns a human-readable path that should uniquely identify this object within a given region If this content object does not have a hierarchy, just str(obj) should suffice

Returns:

The path

Return type:

str

property pk[source]
poi[source]

Type: ForeignKey to POI

Location (related name: translations)

poi_id[source]

Internal field, use poi instead.

prepare_database_save(field)[source]
public_or_draft_source_translation[source]

This property returns the public and draft translation which was used to create the self translation. It derives this information from the Region’s root LanguageTreeNode.

Returns:

The content translation in the source Language (None if no public source translation exists)

public_source_translation[source]

This property returns the public translation which was used to create the self translation. It derives this information from the Region’s root LanguageTreeNode.

Returns:

The content translation in the source Language (None if no public source translation exists)

public_version[source]

This property is a link to the most recent public version of this translation. If the translation itself is not public, this property can return a revision which is older than self.

Returns:

The latest public revision of the translation

read_only: bool = False[source]

Whether this object is read-only and not meant to be stored to the database

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.

replace_urls(urls_to_replace: dict[str, str], user: User | None = None, commit: bool = True) None[source]

Function to replace links that are in the translation and match the given keyword search

Parameters:
Return type:

None

rounded_hix_score[source]

return rounded-up hix_score

save(*args: Any, **kwargs: Any) None[source]

This overwrites the default Django save() method, to update the last_updated field on changes.

Parameters:
  • *args (Any) – The supplied arguments

  • **kwargs (Any) – The supplied kwargs

Raises:

RuntimeError – When the object was locked for database writes

Return type:

None

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(region: Region, language_slug: str, query: str) QuerySet[source]

Searches for all content translations which match the given query in their title or slug. :param region: The current region :param language_slug: The language slug :param query: The query string used for filtering the content translations :return: A query for all matching objects

Parameters:
Return type:

QuerySet

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.

sitemap_alternates[source]

This property returns the language alternatives of a content translation for the use in sitemaps. Similar to available_languages_dict(), but in a slightly different format.

Returns:

A list of dictionaries containing the alternative translations of a content translation

slug[source]

Type: SlugField

Link to the location. String identifier without spaces and special characters. Unique per region and language. Leave blank to generate unique parameter from title.

source_language[source]

This property returns the source language of this language in this Region’s language tree

Returns:

The source language of this translation

source_translation[source]

This property returns the translation which was used to create the self translation. It derives this information from the Region’s root LanguageTreeNode.

Returns:

The content translation in the source Language (None if the translation is in the Region’s default Language)

status[source]

Type: CharField

Status

Choices:

  • DRAFT

  • REVIEW

  • PUBLIC

  • AUTO_SAVE

Manage choices in status

title[source]

Type: TruncatingCharField

Name of the location

translation_state[source]

This function returns the current state of a translation in the given language.

Returns:

A string describing the state of the translation, one of CHOICES

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

Generates the infix of the url of the poi translation object

For information about the components of such an url, see get_absolute_url()

Returns:

The infix of the url

url_prefix[source]

Generates the prefix of the url of the content translation object

For information about the components of such an url, see get_absolute_url()

Returns:

The prefix to the url

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

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

version[source]

Type: PositiveIntegerField

Revision