Beispiel #1
0
def modifier_profil(request):
    if request.method == 'POST':
        form = InscriptionForm(request.POST) #Nous reprenons les donnees
        if form.is_valid():
            nom              = form.cleaned_data['nom']
            prenom           = form.cleaned_data['prenom']
            username         = form.cleaned_data['username']
            password         = form.cleaned_data['password']
            confirm_password = form.cleaned_data['confirm_password']
            email            = form.cleaned_data['email']
            #birthday         = form.cleaned_data['birthday']
            telephone        = form.cleaned_data['telephone']
            adresse          = form.cleaned_data['adresse']
            user = request.user
            user.username = username
            user.email = email
            user.set_password(password)
            user.first_name = prenom
            user.last_name = nom
            user.save()
            membre = user.membre
            membre.adress = adresse
            membre.phone_number = telephone
            membre.save()

            return render(request,'index.html')
            #membre = Membre(pseudo=pseudo,password=password,nom=nom,prenom=prenom,email=email,adresse=adresse,num_tel=num_tel)
            #membre.save()

    else:
        utilisateur = request.user
        form = InscriptionForm(initial={'nom':utilisateur.first_name, 'prenom':utilisateur.last_name, 'username':utilisateur.username, 'email':utilisateur.email, 'telephone':utilisateur.membre.phone_number,'adresse':utilisateur.membre.adress})
    return render(request,'membre/profil.html',locals())
Beispiel #2
0
def inscription(request):
    if request.method == 'POST':
        form = InscriptionForm(request.POST)  #Nous reprenons les donnees
        if form.is_valid():
            nom = form.cleaned_data['nom']
            prenom = form.cleaned_data['prenom']
            username = form.cleaned_data['username']
            password = form.cleaned_data['password']
            confirm_password = form.cleaned_data['confirm_password']
            email = form.cleaned_data['email']
            #birthday         = form.cleaned_data['birthday']
            telephone = form.cleaned_data['telephone']
            adresse = form.cleaned_data['adresse']

            user = User(username=username, email=email)
            user.set_password(password)
            user.first_name = prenom
            user.last_name = nom
            user.save()
            membre = Membre(user=user, adress=adresse, phone_number=telephone)
            membre.save()
            panier = Panier(user=user)
            panier.save()

            return render(request, 'index.html')
            #membre = Membre(pseudo=pseudo,password=password,nom=nom,prenom=prenom,email=email,adresse=adresse,num_tel=num_tel)
            #membre.save()

    else:
        form = InscriptionForm()
    return render(request, 'membre/inscription.html', locals())
Beispiel #3
0
def inscription(request):
    if request.method == 'POST':
        form = InscriptionForm(request.POST) #Nous reprenons les donnees
        if form.is_valid():
            nom              = form.cleaned_data['nom']
            prenom           = form.cleaned_data['prenom']
            username         = form.cleaned_data['username']
            password         = form.cleaned_data['password']
            confirm_password = form.cleaned_data['confirm_password']
            email            = form.cleaned_data['email']
            #birthday         = form.cleaned_data['birthday']
            telephone        = form.cleaned_data['telephone']
            adresse          = form.cleaned_data['adresse']

            user = User(username=username,email=email)
            user.set_password(password)
            user.first_name = prenom
            user.last_name = nom
            user.save()
            membre = Membre(user=user, adress=adresse, phone_number=telephone)
            membre.save()
            panier = Panier(user=user)
            panier.save()

            return render(request,'index.html')
            #membre = Membre(pseudo=pseudo,password=password,nom=nom,prenom=prenom,email=email,adresse=adresse,num_tel=num_tel)
            #membre.save()

    else:
        form = InscriptionForm()
    return render(request,'membre/inscription.html',locals())
Beispiel #4
0
def modifier_profil(request):
    if request.method == 'POST':
        form = InscriptionForm(request.POST)  #Nous reprenons les donnees
        if form.is_valid():
            nom = form.cleaned_data['nom']
            prenom = form.cleaned_data['prenom']
            username = form.cleaned_data['username']
            password = form.cleaned_data['password']
            confirm_password = form.cleaned_data['confirm_password']
            email = form.cleaned_data['email']
            #birthday         = form.cleaned_data['birthday']
            telephone = form.cleaned_data['telephone']
            adresse = form.cleaned_data['adresse']
            user = request.user
            user.username = username
            user.email = email
            user.set_password(password)
            user.first_name = prenom
            user.last_name = nom
            user.save()
            membre = user.membre
            membre.adress = adresse
            membre.phone_number = telephone
            membre.save()

            return render(request, 'index.html')
            #membre = Membre(pseudo=pseudo,password=password,nom=nom,prenom=prenom,email=email,adresse=adresse,num_tel=num_tel)
            #membre.save()

    else:
        utilisateur = request.user
        form = InscriptionForm(
            initial={
                'nom': utilisateur.first_name,
                'prenom': utilisateur.last_name,
                'username': utilisateur.username,
                'email': utilisateur.email,
                'telephone': utilisateur.membre.phone_number,
                'adresse': utilisateur.membre.adress
            })
    return render(request, 'membre/profil.html', locals())