예제 #1
0
def registration(request):
    if request.method == 'POST':
        form = RegistrationForm(request.POST)
        if form.is_valid():
            data = form.cleaned_data
            model = Form()
            model.fullname = data['fullname']
            model.wcaid = data['wcaid']
            model.country = data['country']
            model.city = data['city']
            model.email = data['email']
            model.tshirt = data['tshirt']
            model.nick = data['nick']
            model.accomodation = data['accomodation']
            model.born = datetime.date(int(data['bornyear']), int(data['bornmonth']), int(data['bornday']))
            model.events = [str(ev) for ev in data if ev.startswith('ev_') and data[ev] == True]
            model.status = 1
            model.put()

            return HttpResponseRedirect('/thanks')
    else:
        form = RegistrationForm()

    return render_to_response('registration.html', {
        'form': form,
        'page': 'registration',
        'years': range(1900, 2009),
        'months': range(1, 13),
        'days': range(1, 32),
        })
예제 #2
0
def signup(request):
    rider = get_rider(request)
    
    if rider:
        return HttpResponseRedirect('/entourage/')
    
    if request.method == 'POST':
        form = RegistrationForm(request.POST, request.FILES)
        if form.is_valid():
            rider = form.save(commit=False)
            
            if not rider.avatar:
                fname = generate_filename(rider, 'default.jpg')
                rider.avatar = fname
                default = settings.MEDIA_ROOT + 'riders/default.jpg'
                with open(default) as default:
                    with open(fname, 'w') as f:
                        f.write(default.read())
            
            rider.save()
        else:
            return render(request, 'entourage/signup.html', {'form': form})
        return HttpResponseRedirect('/entourage/login')
    else:
        form = RegistrationForm()

    return render(request, 'entourage/signup.html', {'form': form})
예제 #3
0
파일: views.py 프로젝트: uditvirwani/capp
def register(request):
    template = 'register.html'

    if request.method == 'POST':
        form = RegistrationForm(request.POST)
        if form.is_valid():
            delegate = Delegates(username=request.POST['username'],
                                 password=md5.md5(request.POST['password']).hexdigest(),
                                 fname=request.POST['fname'],
                                 sname=request.POST['sname'],
                                 dob=request.POST['dob'],
                                 email=request.POST['email'])
            delegate.save();
            user = User.objects.create_user(request.POST['username'],
                                            request.POST['email'],
                                            request.POST['password'])
            user.save();
            #send_mail("djahfaj","aouhfpoa","*****@*****.**",['*****@*****.**'],fail_silently=False)
            return HttpResponse("Logged In Sucessfully")
    else :
        form = RegistrationForm()
    data = {
        'form' : form
    }
    return render_to_response(template,data,context_instance = RequestContext(request))
예제 #4
0
파일: views.py 프로젝트: DiyarS/CMPSC431W
def register(request):
    """
    User registration view.
    """
    if request.method == 'POST':
        form = RegistrationForm(data=request.POST)
        if form.is_valid():
            user = form.save()
            return redirect('/')
    else:
        form = RegistrationForm()
    return render_to_response('register.html', {
        'form': form,
    }, context_instance=RequestContext(request))
예제 #5
0
파일: views.py 프로젝트: DiyarS/CMPSC431W
def register_new_user(request):
    if request.method == 'POST':
        #usernamE = request.POST.get('username', '')
        #password = request.POST.get('password', '')
        #emaiL = request.POST.get('email', '')
        #phonE = request.POST.get('phone_number', '')

        form = RegistrationForm(data = request.POST)
        if form.is_valid():
            user = form.save()
            return HttpResponseRedirect('/online_store/register_success')
        else:
            return HttpResponseRedirect('online_store/loggedin.html')

    else:
        form = RegistrationForm()

    args = {}
    args.update(csrf(request))

    args['form'] = form

    return render_to_response('invalid_login.html', args)