I believe you are mixing methods.

Django has built in generic views and generic forms for example.

But, you have used a template with standard (html) from syntax.

Since you are doing a post, request.

In your view just assign a variable to each variable in the form that
you are pulling back and then you can use those variables for the 2
functions that you wanted to achieve.

1. use the variables to insert a row into a database table
for example
names=request.names
etc

sql to insert into table
2. create a dcitionary to respond to the users request in the

[('names':names,       )]
 render_to_response('mainpage.html', dictionary values)


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})

On Jan 14, 12:13 am, coded kid <duffleboi...@gmail.com> wrote:
> 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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to