[Django]-Django AttributeError: 'InterestsForm' object has no attribute '_errors'

10👍

This code can’t possibly work at all, because you override the __init__ method of the form so that a) you only accept a request argument – and not any of the other things a form is expecting, like data or initial – and b) you never call the superclass init method to initialise the things the rest of the form code expects. You need to preserve the signature and call super.

def __init__(self, *args, **kwargs):
     request = kwargs.pop('request')
     self.user = request.user
     super(InterestsForm, self).__init__(*args, **kwargs)

Leave a comment