Place Categories
This package contains page-related data models:
Place Category
- class integreat_cms.cms.models.place_categories.place_category.PlaceCategory(*args, **kwargs)[source]
Bases:
AbstractBaseModelData model representing a Place 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:
places (Reverse
ForeignKeyfromPlace) – All places of this place category (related name ofcategory)translations (Reverse
ForeignKeyfromPlaceCategoryTranslation) – All translations of this place 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<Place Category: PlaceCategory object (id, category name)>. It is used for logging.- Returns:
The canonical string representation of the category
- Return type:
- get_translation(language_slug: str) PlaceCategoryTranslation | None[source]
Get the translation of this category in a given language
- Parameters:
language_slug (str) – language in which the place category is to be shown
- Returns:
translation of the place category in the language if no translation is saved for the language, the category name of the PlaceCategory
- Return type:
PlaceCategoryTranslation | None
- name[source]
This function returns the name of the category in the “best” translation
- Returns:
The name of the category
Place Category Translation
- class integreat_cms.cms.models.place_categories.place_category_translation.PlaceCategoryTranslation(*args, **kwargs)[source]
Bases:
AbstractBaseModelData model representing a Place category translation.
- Parameters:
id (BigAutoField) – Primary key: ID
name (CharField) – Category name. The name of the place category.
Relationship fields:
- Parameters:
category (
ForeignKeytoPlaceCategory) – Category (related name:translations)language (
ForeignKeytoLanguage) – Language (related name:place_category_translations)
- exception DoesNotExist[source]
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned