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 | 1 | from django.contrib import admin |
| 2 | 2 | from .models import User |
| 3 | +from .forms import ProfileForm | |
| 3 | 4 | |
| 4 | 5 | class UserAdmin(admin.ModelAdmin): |
| 5 | 6 | list_display = ['username', 'name', 'email', 'is_staff', 'is_active'] |
| 6 | 7 | search_fields = ['username', 'name', 'email'] |
| 8 | + form = ProfileForm | |
| 7 | 9 | |
| 8 | 10 | admin.site.register(User, UserAdmin) |
| 9 | 11 | \ No newline at end of file | ... | ... |
users/forms.py
| ... | ... | @@ -7,7 +7,7 @@ from .models import User |
| 7 | 7 | |
| 8 | 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 | 12 | def save(self, commit=True): |
| 13 | 13 | super(ProfileForm, self).save(commit=False) |
| ... | ... | @@ -20,6 +20,9 @@ class ProfileForm(forms.ModelForm): |
| 20 | 20 | class Meta: |
| 21 | 21 | model = User |
| 22 | 22 | fields = ['username', 'name', 'email', 'password', 'birth_date', 'city', 'state', 'gender', 'cpf', 'phone', 'image'] |
| 23 | + widgets = { | |
| 24 | + 'password':forms.PasswordInput | |
| 25 | + } | |
| 23 | 26 | |
| 24 | 27 | class UserForm(forms.ModelForm): |
| 25 | 28 | ... | ... |