def reg_user request This is view for registration user in database if

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
def reg_user(request):
"""This is view for registration user in database"""
if request.user.is_anonymous():
if request.method == 'POST':
form1 = UserForm(request.POST)
if form1.is_valid():
user = form1.save()
profile = ClientProfile(user=user)
profile.save()
form2 = ClientForm(request.POST, instance=profile)
if form2.is_valid():
form2.save()
return render_to_response('accounts/welcome.html')
form1 = UserForm()
form2 = ClientForm()
return render_to_response('accounts/registration.html',
{'form1':form1, 'form2':form2})
return render_to_response('accounts/login_success.html', {})