-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforms.py
38 lines (31 loc) · 1.11 KB
/
forms.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth import password_validation
from django.utils.translation import ugettext_lazy as _
class UserGroups(forms.ModelForm):
class Meta:
model = User
fields = (
'groups',
)
widgets = {
'groups': forms.SelectMultiple(attrs={"class": "form-control select2"})
}
class CustomUserForm(UserCreationForm):
password1 = forms.CharField(
label=_("Password"),
strip=False,
widget=forms.PasswordInput(attrs={"class": "form-control"}),
help_text=password_validation.password_validators_help_text_html(),
)
password2 = forms.CharField(
label=_("Password confirmation"),
widget=forms.PasswordInput(attrs={"class": "form-control"}),
strip=False,
help_text=_("Enter the same password as before, for verification."),
)
class Meta(UserCreationForm.Meta):
widgets = {
'username': forms.TextInput(attrs={"class": "form-control"}),
}