UnicodeReprMixIn

 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

  1. YAAS (Yet Another Auto Slug) by carljm 4 years ago
  2. slug filename by willhardy 2 years, 10 months ago
  3. Human readable file names decorator by maxk 1 year, 1 month ago
  4. Ordered items in the database - alternative by Leonidas 4 years, 11 months ago
  5. A ModelChoiceField with support for title in options based on a field in the model by celopes 1 year, 9 months ago

Comments

ashcrow (on January 18, 2009):

If you don't like the snippet please comment on what would make it better ;-).

#

(Forgotten your password?)