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: AbstractBaseModel

Data 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:
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:

str

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

prefetched_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

Place Category Translation

class integreat_cms.cms.models.place_categories.place_category_translation.PlaceCategoryTranslation(*args, **kwargs)[source]

Bases: AbstractBaseModel

Data 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:
exception DoesNotExist[source]

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned[source]

Bases: MultipleObjectsReturned

get_repr() str[source]

This overwrites the default Django __repr__() method which would return <Place CategoryTranslation: PlaceCategoryTranslation object (id, category name)>. It is used for logging.

Returns:

The canonical string representation of the category translation

Return type:

str