Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9150493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:37:06+00:00 2026-06-17T11:37:06+00:00

Hello, I’m trying to use a modified __init__ form method, but I am encountering

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:37:07+00:00Added an answer on June 17, 2026 at 11:37 am

    You’ve changed the signature of the form’s __init__ method so that vUserProfile is the first argument. But here:

    formPessoa = ClienteForm(request.POST, instance=cliente, vUserProfile=profile)
    

    you pass request.POST as the first argument – except that this will be interpreted as vUserProfile. And then you also try to pass vUserProfile as a keyword arg.

    Really, you should avoid changing the method signature, and just get the new data from kwargs:

    def __init__(self, *args, **kwargs):
        vUserProfile = kwargs.pop('vUserProfile', None)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I use the following code in order to retrieve an events infoormation from
Hello! I've been programming for a long time but just started developing for android,
Hello I've got this query to get users by email, which is an unique
Hello i'm trying create an application allowing me host any kind of file. In
hello need help in regex i use this to split strings with capital letters
Hello I want to collect output of following command into some variable.How can I
Hello again; i need to show X,Y,Risk in ListBoxes. But i can not do
Hello I am trying to implement a wake lock for an application. PowerManager pm
Hello and thanks for the help. I am using the following code to set
Hello I am trying to make an invisible button (still functional and clickable), because

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.