antares.apps.core.mixins package — Antares 0.0.2 documentation

# antares.apps.core.mixins package

## Submodules

## antares.apps.core.mixins.enum_utils_mixin module

class `antares.apps.core.mixins.enum_utils_mixin.` `EnumUtilsMixin`

  Bases: `object`

  classmethod `as_choices`()

    Converts the dict to the format needed for Django choices in templates

    Returns

      the list of options with the value as id and the label (which can be translated) as text

  classmethod `as_dict`()

    Converts the Enumeration into a dict

    Returns

      the newly created dict

  classmethod `to_enum`(element)

    Returns the enumeration value based on the element passed or none if nothing match

    Parameters

      element – the element to convert

## Module contents

class `antares.apps.core.mixins.` `EnumUtilsMixin`

  Bases: `object`

  classmethod `as_choices`()

    Converts the dict to the format needed for Django choices in templates

    Returns

      the list of options with the value as id and the label (which can be translated) as text

  classmethod `as_dict`()

    Converts the Enumeration into a dict

    Returns

      the newly created dict

  classmethod `to_enum`(element)

    Returns the enumeration value based on the element passed or none if nothing match

    Parameters

      element – the element to convert