sshwsfc / xadmin

Drop-in replacement of Django admin comes with lots of goodies, fully extensible with plugin support, pretty UI based on Twitter Bootstrap.
http://www.xadmin.io
BSD 3-Clause "New" or "Revised" License
4.76k stars 1.41k forks source link

重置密码时,点击邮箱中的链接报的错__init__() takes 1 positional argument but 4 were given #687

Open yanlingsishao opened 5 years ago

yanlingsishao commented 5 years ago

init() takes 1 positional argument but 4 were given 网上说将xadmin\plugins\passwords.py 八十几行current_app=self.admin_site.name,删除 但是还是报这个错。

yanlingsishao commented 5 years ago

主要是重置密码时,点击邮箱中的链接报的错

RyanLoil commented 4 years ago

同样的问题

RyanLoil commented 4 years ago

考虑django 2.x已经移除了password_reset_confirm,debug的时候,将import改为 from django.contrib.auth.views import PasswordResetConfirmView as password_reset_confirm 考虑PasswordResetConfirmView本身是个类,参量是PasswordContextMixin这个类,所以我粗略判断应该是传递参数的时候 ` def do_view(self, request, uidb36, token, *args, **kwargs): context = super(ResetPasswordComfirmView, self).get_context() return password_reset_confirm(request, uidb36, token, template_name=self.password_reset_confirm_template, token_generator=self.password_reset_token_generator, set_password_form=self.password_reset_set_form, post_reset_redirect=self.get_admin_url('xadmin_password_reset_complete'),

current_app=self.admin_site.name,

                                  extra_context=context)`

这一部分代码应该封装为一个类整体传递过去,但是具体怎么做还是没试出来