I'm not completely sure, but it looks as though your variable 'body':
body = forms.CharField(widget = forms.Textarea())

should be:
body = forms.CharField(widget=forms.Textarea)

with next area not as a function.
http://docs.djangoproject.com/en/dev/ref/forms/widgets/#django.forms.Form.widget


On Apr 16, 8:14 pm, JoJo <culligan.joanne...@gmail.com> wrote:
> Hi all, i have an error here im not sure what it means can anyone help
> me
>
> here is my models.py file##
> class AddStuffForm(forms.Form):
>
>         title = forms.CharField(max_length=100)
>         body = forms.CharField(widget = forms.Textarea())
>
>         def save(self):
>             new_gossip =  Gossip.objects.create(title  =['title'],
>                                                 body =['body'])
>
> here is my views.py file##
> def add_gossip(request):
>     if request.method == 'POST':
>         form = AddStuffForm(data=request.POST)
>         if form.is_valid():
>             form.save()
>             return HttpResponseRedirect("/links/")
>     else:
>         form = AddStuffForm()
>     return render_to_response('add_gossip.html',
>                               { 'form': form})
>
> Traceback:
> File "c:\Python26\lib\site-packages\django\core\handlers\base.py" in
> get_response
>   92.                 response = callback(request, *callback_args,
> **callback_kwargs)
> File "c:\django\gossip2go\..\gossip2go\applications\views.py" in
> add_gossip
>   169.             form.save()
> File "c:\django\gossip2go\applications\models.py" in save
>   131.                                                 body =['body'])
> File "c:\Python26\lib\site-packages\django\db\models\manager.py" in
> create
>   126.         return self.get_query_set().create(**kwargs)
> File "c:\Python26\lib\site-packages\django\db\models\query.py" in
> create
>   314.         obj = self.model(**kwargs)
> File "c:\Python26\lib\site-packages\django\db\models\base.py" in
> __init__
>   323.                 raise TypeError, "'%s' is an invalid keyword
> argument for this function" % kwargs.keys()[0]
>
> Exception Type: TypeError at /add_gossip/
> Exception Value: 'body' is an invalid keyword argument for this
> function
>
> 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 
> athttp://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-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.

Reply via email to