POI Categories
This package contains page-related data models:
POI Category
- class integreat_cms.cms.models.poi_categories.poi_category.POICategory(*args, **kwargs)[source]
Bases:
AbstractBaseModel
Data model representing a POI category.
- Parameters:
id (BigAutoField) – Primary key: ID
icon (CharField) – Icon. Select an icon for this category
color (CharField) – Color. Select a color for map pins with this category
Reverse relationships:
- Parameters:
pois (Reverse
ForeignKey
fromPOI
) – All pois of this location category (related name ofcategory
)translations (Reverse
ForeignKey
fromPOICategoryTranslation
) – All translations of this location category (related name ofcategory
)
- exception DoesNotExist[source]
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned
- 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
- best_translation[source]
This function returns the translation of this category in the current backend language and if it doesn’t exist, it provides a fallback to the first translation.
- Returns:
The “best” translation of this category for displaying in the backend
- get_repr() str [source]
This overwrites the default Django
__repr__()
method which would return<POI Category: POICategory object (id, category name)>
. It is used for logging.- Returns:
The canonical string representation of the category
- Return type:
- get_translation(language_slug: str) POICategoryTranslation | None [source]
Get the translation of this category in a given language
- Parameters:
language_slug (str) – language in which the poi category is to be shown
- Returns:
translation of the poi category in the language if no translation is saved for the language, the category name of the POICategory
- Return type:
POICategoryTranslation | None
- name[source]
This function returns the name of the category in the “best” translation
- Returns:
The name of the category
POI Category Translation
- class integreat_cms.cms.models.poi_categories.poi_category_translation.POICategoryTranslation(*args, **kwargs)[source]
Bases:
AbstractBaseModel
Data model representing a POI category translation.
- Parameters:
id (BigAutoField) – Primary key: ID
name (CharField) – Category name. The name of the POI category.
Relationship fields:
- Parameters:
category (
ForeignKey
toPOICategory
) – Category (related name:translations
)language (
ForeignKey
toLanguage
) – Language (related name:poi_category_translations
)
- exception DoesNotExist[source]
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned