I'm new to the web and can't find a solution myself, please help. I have a simple flask web app, and i use flask-admin to create an admin panel and when i try to login to the admin panel, i see an error:
Traceback (most recent call last):
File "D:\flask_app\lib\site-packages\flask\app.py", line 2190, in wsgi_app
response = self.full_dispatch_request()
File "D:\flask_app\lib\site-packages\flask\app.py", line 1486, in full_dispatch_request
rv = self.handle_user_exception(e)
File "D:\flask_app\lib\site-packages\flask\app.py", line 1484, in full_dispatch_request
rv = self.dispatch_request()
File "D:\flask_app\lib\site-packages\flask\app.py", line 1469, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "D:\flask_app\lib\site-packages\flask_security\decorators.py", line 230, in wrapper
return f(*args, **kwargs)
File "D:\flask_app\lib\site-packages\flask_security\views.py", line 77, in login
if form.validate_on_submit():
File "D:\flask_app\lib\site-packages\flask_wtf\form.py", line 86, in validate_on_submit
return self.is_submitted() and self.validate(extra_validators=extra_validators)
TypeError: validate() got an unexpected keyword argument 'extra_validators'
requirements for py39
Flask==2.3.2
Flask-Admin==1.6.1
Flask-Security==3.0.0
WTForms==3.0.1 # 3.0.0/2.3.3 I also checked these versions.
I've wasted enough time and I can't figure out why this is happening :(
I tried to install different versions of the package, but nothing happened
Here is my admin.py:
class AdminMixin:
def is_accessible(self):
return current_user.has_role('admin')
def inaccessible_callback(self, name, **kwargs):
return redirect(url_for('security.login', next=request.url))
class AdminView(AdminMixin, ModelView):
pass
class HomeAdminView(AdminMixin, AdminIndexView):
pass
admin = Admin(app, 'Flask', url='/', index_view=HomeAdminView())
admin.add_view(AdminView(User, db.session))
user_datastore = SQLAlchemyUserDatastore(db, User, Role)
security = Security(app, user_datastore)
i did research, this is the problem of flask_security\forms.py in LoginForm class validation method - missing extra_validators=None in args
solution:
this is a copy of the Flask-Securit in which problems are quickly solved