OK, I fixed it, by defining a 'computed' method that returns the int value in str form. So silly!
def prva_registracija_mm_str (self): return str(self.prva_registracija_mm) Ohwell :-) On 7/17/06, Carlos Yoder <[EMAIL PROTECTED]> wrote: > Forgot to say, I have the same logic working with no problem, but for > a CharField, so this issue must be related to the field's datatype... > > On 7/17/06, Carlos Yoder <[EMAIL PROTECTED]> wrote: > > Hello there, > > > > I'm using a object_detail generic view to display some data. One of > > the object's fields is an IntegerField, with choices limited to > > MONTHS, a tuple of tuples mapping the values. > > > > Now, on the template I want to expand the stored values to the > > 'human_readable' val, using somehting like: > > > > <tr> > > <td class="attr_name">Prva registracija:</td> > > <td class="attr_val"> > > {% for data in MONTHS.items %} > > {% ifequal data.0 object.prva_registracija_mm %} > > {{ data.1 }} > > {% else%} > > debug: {{ data.0}} is not equal to {{ > > object.prva_registracija_mm }} <br> > > {% endifequal %} > > {% endfor %} > > {{ object.prva_registracija_mm}}.{{ > > object.prva_registracija_yyyy}}<td> > > </tr> > > > > The dictionary arrives correctly at the template via this code: > > > > (r'^(?P<object_id>\d+)/$', > > 'django.views.generic.list_detail.object_detail', > > dict(info_dict, extra_context={'MONTHS': dict(MONTHS) })), > > > > ...and everything seems to be fine. When I run the template on the > > browser, the stored value (an integer 2) never matches what I suppose > > is a string '2'. > > > > How should I convert this to same datatypes? I'm sure this is a very > > common task (expanding admin choices), isn't it? > > > > Best regards and big thanks, > > > > -- > > Carlos Yoder > > http://carlitosyoder.blogspot.com > > > > > -- > Carlos Yoder > http://carlitosyoder.blogspot.com > -- Carlos Yoder http://carlitosyoder.blogspot.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---