Commit a9112bb244bf3580aa670813ca4334f1f0179deb
1 parent
fa30fa76
Exists in
master
and in
5 other branches
Fixing password bug
Showing
2 changed files
with
6 additions
and
1 deletions
Show diff stats
users/admin.py
1 | from django.contrib import admin | 1 | from django.contrib import admin |
2 | from .models import User | 2 | from .models import User |
3 | +from .forms import ProfileForm | ||
3 | 4 | ||
4 | class UserAdmin(admin.ModelAdmin): | 5 | class UserAdmin(admin.ModelAdmin): |
5 | list_display = ['username', 'name', 'email', 'is_staff', 'is_active'] | 6 | list_display = ['username', 'name', 'email', 'is_staff', 'is_active'] |
6 | search_fields = ['username', 'name', 'email'] | 7 | search_fields = ['username', 'name', 'email'] |
8 | + form = ProfileForm | ||
7 | 9 | ||
8 | admin.site.register(User, UserAdmin) | 10 | admin.site.register(User, UserAdmin) |
9 | \ No newline at end of file | 11 | \ No newline at end of file |
users/forms.py
@@ -7,7 +7,7 @@ from .models import User | @@ -7,7 +7,7 @@ from .models import User | ||
7 | 7 | ||
8 | class ProfileForm(forms.ModelForm): | 8 | class ProfileForm(forms.ModelForm): |
9 | 9 | ||
10 | - password = forms.CharField(label=_('Password'), widget=forms.PasswordInput) | 10 | + #password = forms.CharField(label=_('Password'), widget=forms.PasswordInput) |
11 | 11 | ||
12 | def save(self, commit=True): | 12 | def save(self, commit=True): |
13 | super(ProfileForm, self).save(commit=False) | 13 | super(ProfileForm, self).save(commit=False) |
@@ -20,6 +20,9 @@ class ProfileForm(forms.ModelForm): | @@ -20,6 +20,9 @@ class ProfileForm(forms.ModelForm): | ||
20 | class Meta: | 20 | class Meta: |
21 | model = User | 21 | model = User |
22 | fields = ['username', 'name', 'email', 'password', 'birth_date', 'city', 'state', 'gender', 'cpf', 'phone', 'image'] | 22 | fields = ['username', 'name', 'email', 'password', 'birth_date', 'city', 'state', 'gender', 'cpf', 'phone', 'image'] |
23 | + widgets = { | ||
24 | + 'password':forms.PasswordInput | ||
25 | + } | ||
23 | 26 | ||
24 | class UserForm(forms.ModelForm): | 27 | class UserForm(forms.ModelForm): |
25 | 28 |