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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:08:28+00:00 2026-06-02T04:08:28+00:00

So I am converting a site from PHP(Codeigniter) to Django, figured it would be

  • 0

So I am converting a site from PHP(Codeigniter) to Django, figured it would be a good way to learn. I can figure most issues out however I am stuck on this one.

In PHP i can $e->estimate = json_encode($_POST['estimate']);

to store an HTML input array as JSON encoded strings in the DB, does python/django offer any similar functionality.

I am looking at simplejson.dumps(request.POST['estimate']) but that throws a MultiValueDictKeyError

The POST contains items like estimate[discount]
estimate[tax]
estimate[shipping]

So can Django/Python do the above, take an HTML input array, JSON econde it and store it in the DB

  • 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-02T04:08:29+00:00Added an answer on June 2, 2026 at 4:08 am

    After having a look at the documentation in django I found that request.POST is an QueryDict object.

    class QueryDict

    In an HttpRequest object, the GET and POST attributes
    are instances of django.http.QueryDict. QueryDict is a dictionary-like
    class customized to deal with multiple values for the same key. This
    is necessary because some HTML form elements, notably , pass multiple values for the same key.

    at https://docs.djangoproject.com/en/dev/ref/request-response/#django.http.QueryDict .

    As a dictionary (JSON object or Python dict) cannot have more than one key the JSON serialiser is throwing the MultiValueDictKeyError saying that you have multiple keys that are the same.

    Not sure how php was doing it, but a fix would be either of the following

    1. Copy the POST QueryDict and modify the contents so there isn’t any duplicate keys.

    2. Change the form data that is being submitted.

    The reason for the QUeryDict is that for forms being submitted you might validly get multiple keys from the form, for multi-select fields etc.

    hope that helps.

    Mark

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

Sidebar

Related Questions

I'm currently converting my site from PHP to Django, but as I'm new to
I'm converting an entire site from Coldfusion to PHP. So, expect many question like
I've been tasked with converting an existing ASP.NET site from using InProc session management
I'm converting a site for a client from a frameset to divs. One feature
I am converting a webforms site to MVC-3 and am trying to pass my
I am converting a personal site over to MVC 2 and I have been
I am trying to fix an ASP.NET site that a friend had botched converting
Converting a couple stored procedures from MySQL to Microsoft SQL server. Everything is going
Converting to ODB.NET from System.Data.OracleClient and need help converting my connection string. Here is
Is converting a file to a byte array the best way to save ANY

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.