def save(self): #.... Better: don't overwrite save method
if form.is_valid(): form.save() and you are fine On Apr 17, 12:30 am, JoJo <culligan.joanne...@gmail.com> wrote: > Hi all, i have created a site where users can leave messages, and > their opinions on certain topics, i have the form inserting the data, > and i have the data saving but when i refresh the page the data > disappears, also when i insert some data into the another text area i > am getting an error saying > > Exception Value: save() takes no arguments (1 given) > > Here is my models.py file: > class AddGossipNowForm(forms.Form): > title = forms.CharField(max_length=50) > description = forms.CharField(widget = forms.Textarea()) > body = forms.Textarea() > > def save(): > new_gossip = Gossip.objects.create(title=['title'], > > description=['description'], > body=['body']) > > Here is my views.py file: > def add_some_gossip(request): > if request.method == "POST": > form = AddGossipNowForm(data=request.POST) > if form.is_valid(): > new_gossip = form.save() > return HttpResponseRedirect("/links/") > else: > form = SignupForm() > return render_to_response('add_some_gossip.html', > {'form':form}) > > So that is 2 errors that i have, the data will disappear when i > refresh and the save function isn't working properly, if anyone could > help me it would be great as forms are not my strongest point in > Django > 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.