Places
This package contains both data models related to Places:
Place and
PlaceTranslation.
Places can be used to store information which is relevant for one specific place, e.g. a place where local authorities
offer a public service. They can also be used as place for an Event.
Place
- class integreat_cms.cms.models.places.place.Place(*args, **kwargs)[source]
Bases:
AbstractContentModelData model representing a Place. It contains all relevant data about its exact position, including coordinates.
- Parameters:
id (BigAutoField) – Primary key: ID
created_date (DateTimeField) – Creation date
do_not_translate_title (BooleanField) – Do not translate the title. Tick if you do not want to translate the title by automatic translation.
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
place_on_map (BooleanField) – Show this place on map. Tick if you want to show this place on map
archived (BooleanField) – Archived. Whether or not the place is read-only and hidden in the API.
temporarily_closed (BooleanField) – Temporarily closed. Whether or not the place 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 place can be made.
opening_hours (JSONField) – Opening hours
barrier_free (BooleanField) – Barrier free. Indicate if the place is barrier free.
Relationship fields:
- Parameters:
region (
ForeignKeytoRegion) – Region (related name:places)icon (
ForeignKeytoMediaFile) – Icon. The best results are achieved with images in 16:9 aspect ratio. (related name:places)category (
ForeignKeytoPlaceCategory) – Category (related name:places)organization (
ForeignKeytoOrganization) – Organization. Specify which organization operates this place. (related name:places)
Reverse relationships:
- Parameters:
translations (Reverse
ForeignKeyfromPlaceTranslation) – All translations of this place (related name ofplace)contacts (Reverse
ForeignKeyfromContact) – All contacts of this place (related name ofplace)events (Reverse
ForeignKeyfromEvent) – All events of this place (related name ofplace)
- exception DoesNotExist[source]
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned
- archive() bool[source]
Archives the place and removes all links of this place from the linkchecker
- Return type:
- 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
- static get_translation_model() ModelBase[source]
Returns the translation model of this content model
- Returns:
The class of translations
- Return type:
ModelBase
- map_url[source]
- Returns:
the link to the Place of the default (public) translation
- property non_archived_contacts: QuerySet[source]
- Returns:
contacts that are not archived and referencing the Place
- property referring_contacts_exist: bool[source]
- Returns:
whether there are contact objects referring the Place. If the contact module is disabled in the region, it’s always False
- short_address[source]
- Returns:
one-line representation of this Place’s address
Place Translation
- class integreat_cms.cms.models.places.place_translation.PlaceTranslation(*args, **kwargs)[source]
Bases:
AbstractContentTranslationData model representing a Place translation
- Parameters:
id (BigAutoField) – Primary key: ID
title (TruncatingCharField) – Name of the place
slug (SlugField) – Link to the place. 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
published_at (DateTimeField) – Publication 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 place in one or two short sentences. This text will be displayed in the Google search results below the title.
Relationship fields:
- Parameters:
language (
ForeignKeytoLanguage) – Language (related name:place_translations)creator (
ForeignKeytoUser) – Creator (related name:place_translations)place (
ForeignKeytoPlace) – Place (related name:translations)links (
GenericRelationtoLink) – Links (related name:place_translation)
Reverse relationships:
- Parameters:
feedback (Reverse
ForeignKeyfromPlaceFeedback) – All feedback of this place translation (related name ofplace_translation)
- exception DoesNotExist[source]
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned
- backend_edit_link[source]
This function returns the absolute url to the editor for this translation
- Returns:
The url
- static default_icon() str | None[source]
- Returns:
The default icon that should be used for this content translation type, or
Nonefor no icon- Return type:
str | None
- static foreign_field() Literal['place'][source]
Returns the string “place” which ist the field name of the reference to the place which the translation belongs to
- Returns:
The foreign field name
- Return type:
Literal[‘place’]
- foreign_object[source]
This property is an alias of the Place foreign key and is needed to generalize the
slug_utilsfor all content types- Returns:
The Place to which the translation belongs
- map_url[source]
- Returns:
the link to the Place on the Integreat map (if it exists), to google maps otherwise
- save(*args: Any, **kwargs: Any) None[source]
Override save to perform unique slug validation
- Parameters:
args (Any)
kwargs (Any)
- Return type:
None
- 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
- status[source]
Type:
CharFieldStatus
Choices:
DRAFTREVIEWPUBLICAUTO_SAVE
Manage choices in
status
- url_infix[source]
Generates the infix of the url of the place translation object
For information about the components of such an url, see
get_absolute_url()- Returns:
The infix of the url