Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Although you haven't added some crucial information on the question (like Employer's model) maybe your problem is when you save and Employer at this line:</p> <pre><code>employer =Employer.objects.create(username=form.cleaned_data["username"],password= form.cleaned_data['password'],first_name=form.cleaned_data['first_name'],last_name=form.cleaned_data['last_name'],email=form.cleaned_data['email'],address=form.cleaned_data['address'],mobile=form.cleaned_data['mobile']) </code></pre> <p>you have the following properties:</p> <ul> <li>username</li> <li>password</li> <li>first_name</li> <li>last_name</li> <li>email</li> <li>address</li> <li>mobile</li> </ul> <p>If your problem is last_login and date_joined required, you should add inside your <code>create()</code> method:</p> <pre><code>import datetime #last_login=datetime.datetime.now(), date_joined=datetime.date.now() </code></pre> <p>To be like this:</p> <pre><code>employer =Employer.objects.create(last_login=datetime.datetime.now(),date_joined=datetime.datetime.now(),username=form.cleaned_data["username"],password= form.cleaned_data['password'],first_name=form.cleaned_data['first_name'],last_name=form.cleaned_data['last_name'],email=form.cleaned_data['email'],address=form.cleaned_data['address'],mobile=form.cleaned_data['mobile']) </code></pre> <p>So that could solve your problem.</p> <hr> <h2>UPDATE</h2> <p>Since you are using <code>.is_valid()</code>, you need to do it like below. Instead of:</p> <pre><code>if request.method == 'POST': form = SignUpForm(request.POST) print form print"then" print form.errors if form.is_valid(): print 'hello' </code></pre> <p>You need:</p> <pre><code>if request.method == 'POST': data = request.POST.copy() data['date_joined'] = datetime.date.today() data['last_login'] = datetime.datetime.now() form = SignUpForm(data) print form print"then" print form.errors if form.is_valid(): print 'hello' </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload