fixed linting errors
This commit is contained in:
parent
ecc80b939d
commit
4ab42bf3de
4 changed files with 12 additions and 11 deletions
|
|
@ -2,11 +2,12 @@ from django import forms
|
|||
from django.contrib.auth.forms import UserCreationForm
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
|
||||
class RegistrationForm(UserCreationForm):
|
||||
email = forms.EmailField(label = "Email",widget=forms.TextInput(), required=True)
|
||||
first_name = forms.CharField(label="Prénom", widget=forms.TextInput(),required=True)
|
||||
last_name = forms.CharField(label="Nom", widget=forms.TextInput(),required=True)
|
||||
email = forms.EmailField(label="Email", widget=forms.TextInput(), required=True)
|
||||
first_name = forms.CharField(label="Prénom", widget=forms.TextInput(), required=True)
|
||||
last_name = forms.CharField(label="Nom", widget=forms.TextInput(), required=True)
|
||||
|
||||
class Meta:
|
||||
model = User
|
||||
fields = ["username", "password1", "password2", "email", "first_name", "last_name"]
|
||||
fields = ["username", "password1", "password2", "email", "first_name", "last_name"]
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<h1>Création d'utilisateur</h1>
|
||||
<form action = '' method="post">{% csrf_token %}
|
||||
<form action="" method="post">{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<br>
|
||||
<input type="submit" value="Envoyer">
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from django.urls import path
|
||||
|
||||
from .views import signup
|
||||
urlpatterns = [
|
||||
path('', signup, name='signup'),
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
from django import forms
|
||||
from django.contrib.auth import login
|
||||
from django.http.response import HttpResponse
|
||||
|
||||
|
||||
from django.shortcuts import redirect, render
|
||||
|
||||
from .forms import RegistrationForm
|
||||
|
||||
|
||||
def signup(request):
|
||||
if request.method == 'POST':
|
||||
form = RegistrationForm(request.POST)
|
||||
|
|
@ -15,7 +14,7 @@ def signup(request):
|
|||
user.email = form.cleaned_data.get('email')
|
||||
login(request, user)
|
||||
return redirect('/')
|
||||
return render(request,'signup.html', {'form':form})
|
||||
return render(request, 'signup.html', {'form': form})
|
||||
else:
|
||||
form = RegistrationForm()
|
||||
return render(request,'signup.html', {'form':form})
|
||||
return render(request, 'signup.html', {'form': form})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue