[Fixed]-Remove autofocus attribute from field in Django

7👍

(From a comment by @mariodev)

You should be able to do:

self.fields['username'].widget.attrs.pop("autofocus", None)

to remove the item from the attrs collection iff the specified item exists.

Leave a comment