Hello, I'm trying to use a modified __init__
form method, but I am encountering the following error:
TypeError
__init__() got multiple values for keyword argument 'vUserProfile'
I need to pass UserProfile
to my form, to get to dbname
field, and I think this is a solution (my form code):
class ClienteForm(ModelForm):
class Meta:
model = Cliente
def __init__(self, vUserProfile, *args, **kwargs):
super(ClienteForm, self).__init__(*args, **kwargs)
self.fields["idcidade"].queryset = Cidade.objects.using(vUserProfile.dbname).all()
Calls to constructor ClienteForm()
without POST are successful and show me the correct form. But when the form is submitted and the constructor is called with POST, I get the previously described error.