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 6025183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:15:52+00:00 2026-05-23T04:15:52+00:00

Similar to this , but the solution there won’t work for me. Basically, I’m

  • 0

Similar to this, but the solution there won’t work for me.

Basically, I’m trying to do this:

if request.method == 'POST':
    profile_form = UserProfileForm(request.POST)
    # ...
else:
    profile_form = UserProfileForm(request.GET)

But then the form gets validated on a GET. Using initial=request.GET instead doesn’t work either because each of the entries is a list rather than a string. i.e., if I try to go to myform?company=mycompany the mycompany field gets set to [u'mycompany'].

Is there a different way to bypass validation, or is there an easy way to convert a querydict into regular dict (without the lists)?

  • 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-05-23T04:15:53+00:00Added an answer on May 23, 2026 at 4:15 am

    You could turn request.GET into a dictionary with values that aren’t lists like so:

    initial = dict(map(lambda x:(x[0], x[1][0]), dict(request.GET).items()))
    profile_form = UserProfileForm(initial=initial)
    

    That will grab the first item in each list, which means it will only work if all your inputs have different names (which they should or you’re not doing something right). Let me know if it works.

    You may not need the dict(request.GET).items(), you may be able to just put request.GET.items().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is similar to the problem posted here , but that solution doesn't work
There is probably is simple fix for this but I currently have code similar
There are a couple of questions similar to this on stack overflow but not
Similar to this question but for MySQL.... How can I programmatically determine foreign key
Similar question as this one but for a Microsoft Environment. Email --> Exchange Server
This is similar to my previous posting. But this time I want to call
Similar to this question, but for VB.NET since I learned this is a language
This is similar to this question , but I want to include the path
I know this is similar to this question , but I'm using SQL Server
I suppose this might be similar to this question , but I'm wondering if

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.