Since Django 1.2.3, I can't display any Form
Hi, I am new to this group and not sure how to present my problem correctly... I was working with django 1.1 and made a very small and simple application with a "ContactForm" not related to any model. My forms.py : from django import forms class ContactForm(forms.Form): firstname = forms.CharField(max_length=50) lastname = forms.CharField(max_length=50) Recently I updated to Django 1.2.3 and since then I get : "AttributeError: 'CharField' object has no attribute 'prepare_value'" when I try to print this form (or any other form). I even tried this example, http://docs.djangoproject.com/en/1.2/ref/forms/api/#dynamic-initial-values, from Django documentation, in a python shell and I always get the same error... Here is the full stacktrace output : /Library/Python/2.6/site-packages/django/utils/encoding.py in __str__(self) 25 """ 26 def __str__(self): ---> 27 return self.__unicode__().encode('utf-8') 28 29 def smart_unicode(s, encoding='utf-8', strings_only=False, errors='strict'): /Library/Python/2.6/site-packages/django/forms/forms.py in __unicode__(self) 93 94 def __unicode__(self): ---> 95 return self.as_table() 96 97 def __iter__(self): /Library/Python/2.6/site-packages/django/forms/forms.py in as_table(self) 215 row_ender = u'', 216 help_text_html = u'%s', --> 217 errors_on_separate_row = False) 218 219 def as_ul(self): /Library/Python/2.6/site-packages/django/forms/forms.py in _html_output(self, normal_row, error_row, row_ender, help_text_html, errors_on_separate_row) 178 'errors': force_unicode(bf_errors), 179 'label': force_unicode(label), --> 180 'field': unicode(bf), 181 'help_text': help_text, 182 'html_class_attr': html_class_attr /Library/Python/2.6/site-packages/django/forms/forms.py in __unicode__(self) 406 if self.field.show_hidden_initial: 407 return self.as_widget() + self.as_hidden(only_initial=True) --> 408 return self.as_widget() 409 410 def _errors(self): /Library/Python/2.6/site-packages/django/forms/forms.py in as_widget(self, widget, attrs, only_initial) 442 else: 443 data = self.data --> 444 data = self.field.prepare_value(data) 445 446 if not only_initial: AttributeError: 'CharField' object has no attribute 'prepare_value'. I googled "prepare_value + django" and didn't find any other person having this problem. What am I doing wrong? Any clue would be a great help! Thanks in advance. -- 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.
Re: Since Django 1.2.3, I can't display any Form
2010/9/24 François Bonnefont > I am new to this group and not sure how to present my problem > correctly... > > I was working with django 1.1 and made a very small and simple > application with a "ContactForm" not related to any model. > > My forms.py : > > from django import forms > > class ContactForm(forms.Form): >firstname = forms.CharField(max_length=50) >lastname = forms.CharField(max_length=50) > > > Recently I updated to Django 1.2.3 and since then I get : > > "AttributeError: 'CharField' object has no attribute 'prepare_value'" > when I try to print this form (or any other form). > It sounds like your 1.2.3 update did not entirely work. Specifically the error seems to imply you are running with a 1.2.3 level of the django/forms/forms.py file but some earlier level of django/forms/fields.py. I'd delete the current Django installation and re-install 1.2.3 from scratch. Karen -- http://tracey.org/kmt/ -- 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.
Re: Since Django 1.2.3, I can't display any Form
Hi, I finally came up with the same conclusion and I moved the allnew django directory to /Library/Python/2.6/site-packages/ to replace the old one. It seemed to work. Thanks for your quick answer! François. On 25 sep, 04:57, Karen Tracey wrote: > 2010/9/24 François Bonnefont > > > > > I am new to this group and not sure how to present my problem > > correctly... > > > I was working with django 1.1 and made a very small and simple > > application with a "ContactForm" not related to any model. > > > My forms.py : > > > from django import forms > > > class ContactForm(forms.Form): > > firstname = forms.CharField(max_length=50) > > lastname = forms.CharField(max_length=50) > > > Recently I updated to Django 1.2.3 and since then I get : > > > "AttributeError: 'CharField' object has no attribute 'prepare_value'" > > when I try to print this form (or any other form). > > It sounds like your 1.2.3 update did not entirely work. Specifically the > error seems to imply you are running with a 1.2.3 level of the > django/forms/forms.py file but some earlier level of django/forms/fields.py. > I'd delete the current Django installation and re-install 1.2.3 from > scratch. > > Karen > --http://tracey.org/kmt/ -- 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.