Questions tagged [django-jsonfield]
162 questions
0
votes
1 answer
Problem with Django Serializer involving nested JSON with null, and boolean values true or false
I've started using Django just late April this year and this is my first time to deal with bunch of JSONB data. Hope someone can give some inputs as to the cause of this exception:
Error in formatting: TypeError: the JSON object must be str, bytes…

R Maglaya
- 36
- 6
0
votes
0 answers
Django JSONfield update element in list
Update: Thanks for the comment below, I'm updating the question.
I'm using a JSONField to store a list of elements in this format:
[{"name": "field1", "value": "100", type:"number"}, {"name": "field2", "value": "500", "type":"number"}]
I can have…

Kevin Ramirez Zavalza
- 1,629
- 1
- 22
- 34
0
votes
1 answer
How to insert JavaScript object into Django JSONField
In my django web app, I have two pages- One is a form for the user to fill out the name, size, image, and specify the names of some points of interest on the image. The next page displays that image and allows the user to place some SVG circles…

JasonFitz
- 183
- 1
- 11
0
votes
1 answer
How to query a JSONField comprising a list of values in DJANGO
I am using JSONField to store the configuration parameter(user_types) as a list as follows:
["user_type1", "user_type2", "user_type3"]
How to query to filter elements of type "user_type1"? The following query is not…

Kiran
- 8,034
- 36
- 110
- 176
0
votes
2 answers
How to remove extra data from JSONField in django rest framework?
I have a model like this:
class Things(models.Model):
data = models.JSONField(default=dict)
and structure of data is like this:
{
"item" : "sugar",
"quantity" : "2",
"cost" : 220
}
Note that it is not mandatory for data to contain all…

Puneet Garg
- 1
- 2
0
votes
1 answer
Django djsonfield Decimal stored as string in expressions
I have a JSONField with some financial data. I cannot store it as a float, because I need precision, so I store it as a string.
My model looks like this
class Finance(models.Model)
bill_data = JSONField(
verbose_name=_("Bill data"),
…

alis01
- 169
- 1
- 3
- 11
0
votes
2 answers
How to Create ,Get and update JSON data in Django model Text field?
I seen many answer related this problem but I confused how to implement this.
My requirement is:
(Create)First create data with key and value:
{"pradip" : 80} and store in user_rate_details model field.
(Update)Second time append new data in this…

Pradip Kachhadiya
- 2,067
- 10
- 28
0
votes
1 answer
Django,how to filter multiple JSONField data?
Im using django with postgres i was able to add multiple filters in my views but mu question here is is there any possibility that i can filter multiple same jsonfield with different values:
ex i can filter…

Astrit Maliku
- 15
- 1
- 5
0
votes
1 answer
How can i use jsonfield in F expression?
i have jsonfield in model,and i want to run this query:
Notification.objects.filter(Q(data__payload__request_visit_time__gte=(timezone.now() - timedelta(minutes=1) * ((1 + F("data__payload__visit_duration_plan")) * 15)).isoformat()))
but…

arezoo
- 328
- 3
- 14
0
votes
0 answers
JSON fields serializer errors in Django rest framework
when I do input data then I want to check the data key is valid or not by Django rest API JSON serialize field.
I have a JSON serializer in serializers.py like as
class EmployBasicInfoSerializers(serializers.Serializer):
basic_info =…

M N Tushar
- 258
- 1
- 5
- 16
0
votes
2 answers
Storing File in Json Field, Django
I'm working on a project which requires users to submit posts of various forms.
There are posts that require images and others that require videos. To deal with this and other complexities, I was thinking of using jsonfields.
My current issue is…

Timothy Oliver
- 470
- 9
- 19
0
votes
1 answer
How to change my models.TextField to models.JSONField?
I'm using django as my backend and it was working very fine, but after I tried to replaced text = models.TextField(blank=True, null=True) text = models.JSONField(blank=True, null=True) but I got
the text field is shown as string with slashes…

Ali Husham
- 816
- 10
- 31
0
votes
2 answers
Sorting the django objects based on SerializerMethodField
I am trying to order the user profiles based on the timestamp of the last message in between both the users.
I am using SerializerMethodField to get the timestamp of the last message.
is there any way I can sort the data?
class…

saibhaskar
- 435
- 6
- 21
0
votes
2 answers
How do I change a value in django database on button click in HTML?
I have a booleanField in my hostelApplication model, I want to change that field using html button, but I don't know much about js. Please anyone tell me what I am doing wrong.
here is my models.py, I have shown only necessary fieds.
class…
0
votes
1 answer
How do I extract all distint values for a specific key inside JSONField in Django running on Postgres?
Summary:
For a dropdown I need to compute the distinct values for a specific key stored inside a JSONField in a table in Postgres database. Worst case scenario: The table contains 1-10 million entries.
Background:
I'm developing a setup in which I…

Albertsen
- 155
- 2
- 9