On Thu, Sep 24, 2009 at 4:27 PM, JF Simon <ad...@jfsimon.fr> wrote: > > I launched form.as_table() in my terminal and the traceback is : > > File "<console>", line 1, in ? > File "/usr/lib/python2.4/site-packages/django/forms/forms.py", line > 190, in as_table > return self._html_output(u'<tr><th>%(label)s</th><td>%(errors)s% > (field)s%(help_text)s</td></tr>', u'<tr><td colspan="2">%s</td></tr>', > '</td></tr>', u'<br />%s', False) > File "/usr/lib/python2.4/site-packages/django/forms/forms.py", line > 165, in _html_output > output.append(normal_row % {'errors': force_unicode(bf_errors), > 'label': force_unicode(label), 'field': unicode(bf), 'help_text': > help_text}) > File "/usr/lib/python2.4/site-packages/django/forms/forms.py", line > 356, in __unicode__ > return self.as_widget() > File "/usr/lib/python2.4/site-packages/django/forms/forms.py", line > 391, in as_widget > return widget.render(name, data, attrs=attrs) > File "/usr/lib/python2.4/site-packages/django/forms/widgets.py", > line 647, in render > widget_value = value[i] > > And now the famous error : > > TypeError: unsubscriptable object > > It seems that "value" is not iterable or something like that ... I > don't understand. > I tried some things but I always get the same error. > > I'm loosing my mind. I think I have to go to bed ... > > As I said in the previous response, you need to take a look at your compress and decompress methods. What you posted earlier simply returned what they were given, and that is not going to work. These methods need to pack things into lists and unpack them back into single values. If they don't do this properly then you will get errors like this, where Django code is assuming value is a list, when in fact it has not been made into a list.
Karen --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---