M
Mulla
hey,
when i submit the form in html , the entered data (fname,lanme,uname.....)all have to come in perl script to store that data in DB.
Python View.py
def ProfileRegistration(request):
if request.user.is_authenticated():
return HttpResponseRedirect('/profile/')
if request.method == 'POST':
form = RegistrationForm(data=request.POST, files=request.FILES)
if form.is_bound and form.is_valid():
user = User.objects.create_user(username=form.cleaned_data['username'],
email=form.cleaned_data['email'],
password=form.cleaned_data['password'],)
new_user= user.save()
profile = Profile(user=user,firstname=form.cleaned_data['firstname'],
lastname=form.cleaned_data['lastname'],
telephone=form.cleaned_data['telephone'],
service=form.cleaned_data['service'],
servicetype=form.cleaned_data['servicetype'],)
new_user = profile.save()
# messages.info(request, "Thank you for registration.Please login to continue")
# login(request, new_user)
return HttpResponseRedirect('/dashboard/')
else:
return render_to_response('register.html',{'form': form},context_instance=RequestContext(request))
else:
form = RegistrationForm()
context = {'form':form}
return render_to_response('register.html',context, context_instance=RequestContext(request))
Below in my perl script
#!/usr/bin/perl
use strict;
use warnings;
use user;
my $tempuser = new user ();
if ($tempuser->readbyfirstname('Pervez') eq 1) {
# Continue processing since we found a match
if($tempuser->{lastname} eq 'Noel')
{
print "Name already exists, \n";
}
}
my $tempuser1 = new user();
$tempuser1->readbyemail_id('(e-mail address removed)');
if($tempuser1->{email_id} eq '(e-mail address removed)')
{
print "email_id is in use \n";
}
my $tempuser2 = new user();
$tempuser2->readbyusername('Tim_sir');
if ($tempuser2->{username} eq 'Mulla')
{
print "username is already present\n";
}
else {
print "we have no match\n";
}
my $tempuser4 = new user('pervez', '', 'mulla', '(e-mail address removed)', '193274198');
my $string = $tempuser4->{firstname};
my @c = split(//, $string);
my $userhash = "00$c[0]$c[-1]";
print "$userhash \n";
#$tempuser4->{userhash} = $userhash;
$tempuser4->setuserhash( "$userhash" );
$tempuser4->write;
when I submit data , that data must come in place "my $tempuser4 = new user('pervez', '', 'mulla', '(e-mail address removed)', '193274198');" ...
how can I do this ...>>?
Look forward for hear from you soon
Thank You
when i submit the form in html , the entered data (fname,lanme,uname.....)all have to come in perl script to store that data in DB.
Python View.py
def ProfileRegistration(request):
if request.user.is_authenticated():
return HttpResponseRedirect('/profile/')
if request.method == 'POST':
form = RegistrationForm(data=request.POST, files=request.FILES)
if form.is_bound and form.is_valid():
user = User.objects.create_user(username=form.cleaned_data['username'],
email=form.cleaned_data['email'],
password=form.cleaned_data['password'],)
new_user= user.save()
profile = Profile(user=user,firstname=form.cleaned_data['firstname'],
lastname=form.cleaned_data['lastname'],
telephone=form.cleaned_data['telephone'],
service=form.cleaned_data['service'],
servicetype=form.cleaned_data['servicetype'],)
new_user = profile.save()
# messages.info(request, "Thank you for registration.Please login to continue")
# login(request, new_user)
return HttpResponseRedirect('/dashboard/')
else:
return render_to_response('register.html',{'form': form},context_instance=RequestContext(request))
else:
form = RegistrationForm()
context = {'form':form}
return render_to_response('register.html',context, context_instance=RequestContext(request))
Below in my perl script
#!/usr/bin/perl
use strict;
use warnings;
use user;
my $tempuser = new user ();
if ($tempuser->readbyfirstname('Pervez') eq 1) {
# Continue processing since we found a match
if($tempuser->{lastname} eq 'Noel')
{
print "Name already exists, \n";
}
}
my $tempuser1 = new user();
$tempuser1->readbyemail_id('(e-mail address removed)');
if($tempuser1->{email_id} eq '(e-mail address removed)')
{
print "email_id is in use \n";
}
my $tempuser2 = new user();
$tempuser2->readbyusername('Tim_sir');
if ($tempuser2->{username} eq 'Mulla')
{
print "username is already present\n";
}
else {
print "we have no match\n";
}
my $tempuser4 = new user('pervez', '', 'mulla', '(e-mail address removed)', '193274198');
my $string = $tempuser4->{firstname};
my @c = split(//, $string);
my $userhash = "00$c[0]$c[-1]";
print "$userhash \n";
#$tempuser4->{userhash} = $userhash;
$tempuser4->setuserhash( "$userhash" );
$tempuser4->write;
when I submit data , that data must come in place "my $tempuser4 = new user('pervez', '', 'mulla', '(e-mail address removed)', '193274198');" ...
how can I do this ...>>?
Look forward for hear from you soon
Thank You