On Thu, Apr 8, 2010 at 3:00 AM, mmenchu <mmen...@gmail.com> wrote: > I'm trying to write to one of my templates the display name for > item.category. Item is an object with an IntegerField named > 'category' and a set of specified choices. I call render_to_response > and call get_category_display() but I keep getting > "Could not parse the remainder: '()'". What's the 'right' way of > doing this in the template? Do I need to pre-render the string > before passing it to render_to_response? > > {% for item in lstOfItems%} > {{ item.name }} {{ item.get_category.display()}} > {%endfor%}
First, change get_category.display to get_category_display it is an obvious typo. Them drop the (). This is documented: http://docs.djangoproject.com/en/1.1/topics/templates/#templates http://docs.djangoproject.com/en/1.1/topics/templates/#variables -- Ramiro Morales | http://rmorales.net -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.