id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 11819 Should __unicode__ be used when returning purely numerical values? sampablokuper nobody "http://docs.djangoproject.com/en/dev/intro/tutorial01/#playing-with-the-api says, ""''It's important to add !__unicode!__() methods to your models, not only for your own sanity when dealing with the interactive prompt, but also because objects' representations are used throughout Django's automatically-generated admin.''"" However, if I have a class like the following: {{{ class C19Year(models.Model): value = IntegerRangeField(min_value=1800, max_value=1899) def __unicode__(self): return self.value }}} (where !IntegerRangeField is as given [http://stackoverflow.com/questions/849142/how-to-limit-the-maximum-value-of-a-numeric-field-in-a-django-model here]), I receive the following !TemplateSyntaxError in the admin: '''Caught an exception while rendering: coercing to Unicode: need string or buffer, int found''' So, evidently the manual ought to explain that !__unicode!__ shouldn't be used when returning purely numerical values, or that such values ought to be converted to strings. (Of these two solutions, I'm not sure which is best.)" closed Documentation 1.1 invalid Unreviewed 0 0 0 0 0 0