def indexsignup(request): form = AccountsSignupForm(request.POST) print form.is_valid() if form.is_valid(): email = form.cleaned_data['email'] password = form.cleaned_data['password'] realname = form.cleaned_data['realname'] gender = form.cleaned_data['gender'] student = Student.create_user(username=email, email=email, password=password) url_number = len(Student.objects) student.url_number = url_number public_profile = Public_Profile(realname=realname, gender=gender, face=STATIC_URL + 'img/face.png') student.public_profile = public_profile student.save() sscard = S_S_Card(user=student) sscard.save() event = Event(user=student) event.save() user = authenticate(username=email, password=password) request.session.set_expiry(0) if user is not None and user.is_active: login(request, user) return HttpResponseRedirect('/') else: return render_to_response('404.html', {'STATIC_URL':STATIC_URL})