Source code for superdjango.db.displayed.mixins

# Exports

__all__ = (
    "DisplayNameMixin",
)

# Mixins


[docs]class DisplayNameMixin(object): """Implement consistent proper naming for models that extend this class.""" def __str__(self): return self.get_display_name()
[docs] def get_choice_name(self): """Get the proper name of the record when used as a choice. :rtype: str .. tip:: By default, this just returns ``get_display_name()``, but may be overridden to provide a different name for choices than the regular display name. """ return self.get_display_name()
[docs] def get_display_name(self): """Get the proper name for the current record. :rtype: str .. important:: The extending class must impement this method. """ raise NotImplementedError()