Questions tagged [multi-value-dictionary]

A wrapper around the Dictionary that returns two values instead of one.

A wrapper around the Dictionary that returns two values instead of one.

14 questions
30
votes
5 answers

How to create an empty IReadOnlyCollection

I'm creating an extension method for MultiValueDictionary to encapsulate frequent ContainsKey checks and I was wondering what was the best way to create an empty IReadOnlyCollection?. What I've used so far is new List(0).AsReadOnly() but…
i3arnon
  • 113,022
  • 33
  • 324
  • 344
2
votes
2 answers

Run a query against all values within nested lists of a multi-valued dictionary

I have a 'collections.defaultdict' (see x below) that is a multi-valued dictionary. All values associated with each unique key are stored in a list. >>>x defaultdict(, {'a': ['aa', 'ab', 'ac'], 'b': ['ba', 'bc'], 'c': ['ca',…
2
votes
1 answer

Error serializing MultiValueDictionary(string,string) with Protobuf-net

I am using MultiValueDictionary(String,string) in my project (C# - VS2012 - .net 4.5), which is a great help if you want to have multiple values for each key, but I can't serialize this object with protobuf.net. I have serialized…
1
vote
0 answers

Generating MultivaluedMap parameter definition using annotations with swagger-gradle-plugin (OAS3)

We had next code generated by previous plugin with version OAS2: { "description" : "parameters", "in" : "body", "name" : "body", "required" : false, "schema" : { "type" : "object", …
1
vote
2 answers

How to read or save a file from MultiValueDict in Django

I'm sending a excel file from Angular to Django. I want to read the file using Pandas and perform some operations in the file, but I'm not sure how to do it. class fileupload(APIView) : def post(self, request): f = request.FILES …
1
vote
1 answer

Use MultiValueDictionary instead of Dictionary with NHibernate.Criterion.Restrictions

Currently, I have this code, which works, getting a foodList: var myDictionary = new System.Collections.Generic.Dictionary(); myDictionary .Add("RefId",1); myDictionary.Add("Type", "fruit"); var foodList =…
Al Lelopath
  • 6,448
  • 13
  • 82
  • 139
1
vote
1 answer

why django multivaluedict get returns last element

I have used Django MultiValueDict many times and all the times either I use the entire list stored with a key or I want to use the first value from the list. A common use case is use it as form initial data. My problem is that by default Django…
Rajesh Kaushik
  • 1,471
  • 1
  • 11
  • 16
0
votes
1 answer
0
votes
0 answers

C#: Accessing elements in MultiValueDictionary without loop

I'm using MultiValueDictionary from Microsoft.Experimental.Collections by this way: MultiValueDictionary multiValueDictionary = new MultiValueDictionary(); multiValueDictionary.Add("Device A", "My…
Yousha Aleayoub
  • 4,532
  • 4
  • 53
  • 64
0
votes
1 answer

MultiValueDictKeyError at /update 'date'

I'm trying to update my database but I encountered MultiValueDictKeyError. The problem is triggered by 'date' as: t.date = request.POST.get('date') I tried print(request.POST) with the result:
Aadesh Dhakal
  • 412
  • 6
  • 17
0
votes
2 answers

How can I append a list of values for single dictionary key (1_key : [N_values]) in Python?

I am trying to generate a {single-key : [multi-value]} dictionary in Python from a .txt file. This is the text file (tab-separated), A02.835.583.748 A02.880 0.818181818181818 A02.835.583.748 A02.513 …
PinkBanter
  • 1,686
  • 5
  • 17
  • 38
0
votes
4 answers

How to compare string value in dataframe column and value in cell to create new dataframe based on multi value dictionary?

I have a df that looks like this: id.1.value.1 id.2.value.2 id.1.question id.2.value.2 TRUE FALSE TRUE TRUE I want to create logic that scans the column names of the df and extracts the…
0
votes
0 answers

Django uploading images to a form- ManagementForm data is missing or has been tampered with

I have a Django website, and on one of the pages, I am trying to upload some images using a form. When I click the 'Browse' button to select the file I want to upload, a dialog box opens, and I browse to the file and click OK. The name of the…
Noble-Surfer
  • 3,052
  • 11
  • 73
  • 118
-2
votes
1 answer

MultiValueDictKeyError /create Django validation

I've run into a problem checking my validations I'm trying to make sure that field cant be left empty in a page field. When I click on the page I run into the MultiValueDictKeyError . It leads me to line 61 of my views. if…