mirror of
https://github.com/jazzband/django-admin2.git
synced 2026-03-16 22:20:24 +00:00
Set return of get_update password_url to default value in UserChangeFrom when no instance
This commit is contained in:
parent
5511b4dc8d
commit
a373875c0d
1 changed files with 5 additions and 5 deletions
|
|
@ -313,12 +313,12 @@ class Admin2UserChangeForm(UserChangeForm):
|
|||
def __init__(self, *args, **kwargs):
|
||||
super(Admin2UserChangeForm, self).__init__(*args, **kwargs)
|
||||
print(self.fields['password'].help_text)
|
||||
self.fields['password'].help_text = _("Raw passwords are not stored, so there is no way to see "
|
||||
"this user's password, but you can change the password "
|
||||
"using <a href=\"%s\">this form</a>." % self.get_update_password_url())
|
||||
self.fields['password'].help_text = _("Raw passwords are not stored, so there is no way to see this user's password, but you can change the password using <a href=\"%s\">this form</a>." % self.get_update_password_url())
|
||||
|
||||
def get_update_password_url(self):
|
||||
return reverse_lazy('admin2:password_change', args=[self.instance.pk])
|
||||
|
||||
if self.instance and self.instance.pk:
|
||||
return reverse_lazy('admin2:password_change', args=[self.instance.pk])
|
||||
return 'password/'
|
||||
|
||||
UserCreationForm = floppify_form(UserCreationForm)
|
||||
UserChangeForm = floppify_form(Admin2UserChangeForm)
|
||||
|
|
|
|||
Loading…
Reference in a new issue