Update To 1.11: Typeerror Build_attrs() Takes At Most 2 Arguments (3 Given)
I a updating from 1.10.7 to 1.11.0 and I am getting the following error when viewing a form. I cannot fathom what is wrong with my form at all. Other forms work in the same way. I
Solution 1:
They changed the build_attrs function in Django 1.11/
You may need to upgrade also select2 and markdownx with pip.
pip install select2 markdownx --upgrade
Solution 2:
In the Django 1.11 update, they change the build_attrs class to use only 2 arguments, where all your extra arguments should now be passed in a dict.
So when you use a custom widget that uses the build_attrs function, you need to change the build_attrs call from:
build_attrs(attrs, foo='bizz', bar='baz')
to:
build_attrs(attrs, {'foo':'bizz', 'bar':'baz'})
Thus the culprit is the Select2 class. You can fix it yourself by super-classing and overwriting the render function with the new method or you can check if the author has an update.
Post a Comment for "Update To 1.11: Typeerror Build_attrs() Takes At Most 2 Arguments (3 Given)"