I've created a model form and I was wondering what the correct way to save this was. I've tried adapting the view from the standard django forms docs but maybe it should be different?
This is what i have in my view (it says contact form but its a form that should save contacts in a db): class ContactForm(ModelForm): class Meta: model = Contact def contact_view(request): if request.method == 'Post': form = ContactForm(request.POST) if form.is_valid(): contact= form.save() return HttpResponseRedirect('/thanks/') else: return HttpResponseRedirect('/error/') else: form = ContactForm() tags = Tag.objects.all() return render_to_response('Site/contact.html', locals(), context_instance=RequestContext(request)) And my template is like this: <form method="POST"> {{ form.as_p }} <input type="submit" value="Submit" /> My understanding is that with this setup it should go to thanks/ if the form is valid and error/ if it is not and it doesn't do either, and it doesn't save or come back with any errors either . could someone help me please? Thanks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---