1 2 3 4 5 6 7 8 9 10 11 12 13 | from django.db import models
class UnicodeReprMixIn(object):
"""
Adds a unicode representation using self._unicode.
"""
def __unicode__(self):
"""
Unocode representation of this instance.
"""
return unicode(self.__getattribute__(self._unicode))
|
More like this
- YAAS (Yet Another Auto Slug) by carljm 4 years ago
- slug filename by willhardy 2 years, 10 months ago
- Human readable file names decorator by maxk 1 year, 1 month ago
- Ordered items in the database - alternative by Leonidas 4 years, 11 months ago
- A ModelChoiceField with support for title in options based on a field in the model by celopes 1 year, 9 months ago
Comments
If you don't like the snippet please comment on what would make it better ;-).
#