I'm new to python and django myself but im wondering how form.is_valid() works when form is only initiated a line later.
Doesnt it have to look like this:
if request.user.is_superuser:
if request.method == 'POST':
form = Form_news(request.POST)
if form.is_valid():
mess = form.cleaned_data['messgg']
?!
. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
XSLT Developer
LexisNexis
Marxergasse 25, 1030 Wien
mailto:patrick.szabo@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573
Fax: +43 (1) 534 52 - 146
-----Ursprüngliche Nachricht-----
Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im Auftrag von luca72
Gesendet: Montag, 28. März 2011 15:05
An: Django users
Betreff: form has not attribute cleaned_data
hello i have a form like this:
class Form_news(forms.Form):
messgg = forms.CharField(label = 'Messaggio',max_length=10000,
widget=forms.Textarea)
and in the views i do as follow:
if request.user.is_superuser:
if request.method == 'POST':
if form.is_valid():
form = Form_news(request.POST)
mess = form.cleaned_data['messgg']
i get the error form News has not attribute cleaned_data
Why?
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment