Re: Help me with django Form
Thanks guys! @daniel I still don't get what django doc is trying to
say about ModelForm. Can you please explain further?
On Jan 12, 10:30 am, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Thursday, 12 January 2012 01:49:40 UTC, coded kid wrote:
>
> > Hi guys, I've been trying to signup using the django form I created.
> > Whenever I signup, the form is always saving the id no and not other
> > fields like names, username.pasword,email etc. Below are the codes;
> > In views.py:
> > from django.shortcuts import render_to_response
> > from django.http import HttpResponse
> > from django.template import RequestContext
> > from django.http import HttpResponseRedirect
> > from mymeek.meekme import models
> > from django.views.decorators.csrf import csrf_exempt
> > @csrf_exempt
> > def welcome(request):
> > #Allow new user reg and login, if failed direct the user to signup
> > if request.method=='POST':
> > form=models.Register()
> > new_user=form.save()
> > return HttpResponseRedirect('/logpage/')
> > else:
> > form=models.Register()
> > return render_to_response('mainpage.html',
> > {'form':models.Register})
>
> You haven't defined a form. Just calling a model instance "form" doesn't
> make it one.
> Plus, of course, at no point are you passing the POST values into the
> instantiation.
> Seehttps://docs.djangoproject.com/en/1.3/topics/forms/modelforms/for
> modelforms,
> andhttps://docs.djangoproject.com/en/1.3/topics/forms/#using-a-form-in-a...
> for the general pattern of how to instantiate a form from the POST.
> --
> DR.
--
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.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home