mirror of
https://github.com/kristoferssolo/FOSSDB.git
synced 2025-10-21 17:50:35 +00:00
Update forms
This commit is contained in:
parent
1590ae8e84
commit
c93b6f0856
@ -1,8 +1,8 @@
|
|||||||
from django import forms
|
from django import forms
|
||||||
|
|
||||||
from django.contrib.auth.forms import AuthenticationForm, UserCreationForm
|
from django.contrib.auth.forms import AuthenticationForm, UserChangeForm as BaseUserChangeForm, UserCreationForm
|
||||||
|
|
||||||
from .models import User
|
from .models import Profile, User
|
||||||
|
|
||||||
|
|
||||||
class LoginForm(AuthenticationForm):
|
class LoginForm(AuthenticationForm):
|
||||||
@ -68,3 +68,66 @@ class SignUpForm(UserCreationForm):
|
|||||||
"password1": "",
|
"password1": "",
|
||||||
"password2": "",
|
"password2": "",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class UserChangeForm(BaseUserChangeForm):
|
||||||
|
class Meta(BaseUserChangeForm.Meta):
|
||||||
|
model = User
|
||||||
|
fields = (
|
||||||
|
"username",
|
||||||
|
"email",
|
||||||
|
"first_name",
|
||||||
|
"last_name",
|
||||||
|
)
|
||||||
|
widgets = {
|
||||||
|
"username": forms.TextInput(
|
||||||
|
attrs={
|
||||||
|
"placeholder": "Username",
|
||||||
|
"class": "form-field submit-form",
|
||||||
|
}
|
||||||
|
),
|
||||||
|
"email": forms.EmailInput(
|
||||||
|
attrs={
|
||||||
|
"placeholder": "Email",
|
||||||
|
"class": "form-field submit-form",
|
||||||
|
}
|
||||||
|
),
|
||||||
|
"first_name": forms.TextInput(
|
||||||
|
attrs={
|
||||||
|
"placeholder": "First Name",
|
||||||
|
"class": "form-field submit-form",
|
||||||
|
}
|
||||||
|
),
|
||||||
|
"last_name": forms.TextInput(
|
||||||
|
attrs={
|
||||||
|
"placeholder": "Last Name",
|
||||||
|
"class": "form-field submit-form",
|
||||||
|
}
|
||||||
|
),
|
||||||
|
}
|
||||||
|
labels = {
|
||||||
|
"username": "",
|
||||||
|
"email": "",
|
||||||
|
"first_name": "",
|
||||||
|
"last_name": "",
|
||||||
|
}
|
||||||
|
|
||||||
|
help_text = {
|
||||||
|
"username": None,
|
||||||
|
"email": None,
|
||||||
|
"first_name": None,
|
||||||
|
"last_name": None,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class ProfileForm(forms.ModelForm):
|
||||||
|
class Meta:
|
||||||
|
model = Profile
|
||||||
|
fields = ("picture",)
|
||||||
|
labels = {
|
||||||
|
"picture": "",
|
||||||
|
}
|
||||||
|
|
||||||
|
help_text = {
|
||||||
|
"picture": None,
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user