Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django filter from multiple fields with empty input
I am new to Django and I am right now trying to deal with the issue of filtering based on specific field. React.js is used for the front-end and Django is used as RESTful APIs. For the front-end, users are allowed to choose to either search based on number or name. The info has been successfully collected. The following code just for better understanding and is incomplete. <input type="text" /><label>Search by number</label> <input type="text" /><label>Search by name</label> For the backend, response should filter the queryset based on input information, which is either number or name. However, when I went through the document, I noticed that for filtering, all the filtering fields should be provided. Entry.objects.filter(number=123, name="abc") How can I do the filter based on the given info from the front-end, for example, if user chooses to search by name that Django does: Entry.objects.filter(number=123) while if user chooses to search by name, then Django does: Entry.objects.filter(name="abc") I understand that I can actually create two different APIs endpoints, so the number and name won't interfere each other. However, if there are more filter fields, then it is definitely inefficient to write every single API based on each field. Anyone can help me … -
AWS errors when installing requirements with python 2.7 when EB environment is python 3.6
How do I get the aWS EB instance to use the python 3 version that is already installed on the instance? I can't get a new environment running with Python 3.6 running Django 2.1+. Local (not in virtual env): which python -> /usr/local/bin/python python -V -> Python 2.7.15 which python3 -> /usr/local/bin/python3 python3 -V -> Python 3.6.5 which pip -> /usr/local/bin/pip pip -V -> pip 18.0 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)` which pip3 -> /usr/local/bin/pip3 pip3 -V -> pip 18.0 from /usr/local/lib/python3.6/site-packages/pip (python 3.6) Local in virtualenv mstFirst: which python -> /Users/me/.virtualenvs/mstFirst/bin/python which python3 -> /Users/me/.virtualenvs/mstFirst/bin/python python -V -> Python 3.6.5 python3 -V -> Python 3.6.5 which pip -> /Users/me/.virtualenvs/mstFirst/bin/pip which pip3 -> /Users/me/.virtualenvs/mstFirst/bin/pip3 pip -V -> pip 18.0 from /Users/me/.virtualenvs/mstFirst/lib/python3.6/site-packages/pip (python 3.6) pip3 -V -> pip 18.0 from /Users/me/.virtualenvs/mstFirst/lib/python3.6/site-packages/pip (python 3.6) aws --version -> aws-cli/1.16.9 Python/3.6.5 Darwin/17.7.0 botocore/1.11.9 eb --version -> EB CLI 3.14.4 (Python 3.6.5) eb -list -> * mst-p3 eb -config -> ApplicationName: mst DateUpdated: 2018-09-07 02:15:51+00:00 EnvironmentName: mst-p3 PlatformArn: arn:aws:elasticbeanstalk:us-east-1::platform/Python 3.6 running on 64bit Amazon Linux/2.7.3 settings: … Files: ".elasticbeanstalk/config.yml" branch-defaults: master: environment: mst-p3 environment-defaults: mst-p3: … global: application_name: mst default_platform: 64bit Amazon Linux 2018.03 v2.7.3 running Python 3.6 default_region: us-east-1 workspace_type: Application … ".ebextensions/01_packages.config" packages: yum: … -
Should I build one more realtime server (Socket NodeJs) parallel with Django Rest API
I got confused about developing my Server using Realtime Database. Now I use Django Restful API, I have 2 solutions hope your orentiations: Building one more server using SocketIO (NodeJS) Use Google FireBase Which is the better choice about PRICE? DEVELOPING PERIOD? If you have any solutions, please let me know. Thanks in advance! -
Django QuerySet, Filtering Data Based on The Latest Entry of Each Data's Column/Field equals to a particular Value
#models.py class Orders(models.Model): orderid = models.IntegerField(db_column='orderID', primary_key=True) createdate = models.DateField(db_column='createDate', blank=True, null=True) pickupdate = models.DateField(db_column='pickupDate', blank=True, null=True) returndate = models.DateField(db_column='returnDate', blank=True, null=True) pickupstore = models.ForeignKey(Branch, models.DO_NOTHING, db_column='pickupStore', blank=True, null=True,related_name = 'pickupstore') returnstore = models.ForeignKey(Branch, models.DO_NOTHING, db_column='returnStore', blank=True, null=True,related_name = 'returnstore') rentedvehicle = models.ForeignKey('Vehicles', models.DO_NOTHING, db_column='rentedVehicle', blank=True, null=True) customer = models.ForeignKey(Customer, models.DO_NOTHING, db_column='customer', blank=True, null=True) class Vehicles(models.Model): vehicleid = models.IntegerField(db_column='vehicleID', primary_key=True) make = models.CharField(max_length=45, blank=True, null=True) model = models.CharField(max_length=45, blank=True, null=True) series = models.CharField(max_length=45, blank=True, null=True) Orders model have foreign key rentedvehicle wich refers to Vehicles models I have filtered the data based on the pickupstore state,e.g The list of vehicles that are picked up from store in a particular state Vehicles.objects.filter(orders__pickupstore__state = request.POST['state']) I want to be able to filter the filtered data above so that I can get a list of vehicles that are picked up from store in a particular state WITH its latest entry in Orders models has returnstore__state == a particular state So basically, I want to achieve this : Vehicles.objects.filter(orders__pickupstore__state = request.POST['state']).filter(the latest entry returnstore state =request.POST['state']) -
How do you use Django in Python to make html/css framework much faster?
I've done very tedious task for html and css alone to make pH barometer, but I found out Python Django has a function to do this within a fraction of seconds. How do you do that? <!DOCTYPE html> <html> <head> <title>Color</title> <style type="text/css"> body { background-color: silver; color: white; padding: 20px; font-family: Arial, Verdana, sans-serif;} h1 { background-color: #fffffff; background-color: hsla(0,100%,100%,0.5); color: #64645A; padding: inherit;} p { padding: 5px; margin: 0px;} p.zero{ background-color: rgb(238,62,128);} p.one { background-color: rgb(244,90,139);} p.two { background-color: rgb(243,106,152);} p.three { background-color: rgb(244,123,166);} p.four { background-color: rgb(245,140,178);} p.five { background-color: rgb(245,159,192);} p.six { background-color: rgb(245,176,204);} p.seven { background-color: rgb(0,187,136);} p.eight { background-color: rgb(140,202,242);} p.nine { background-color: rgb(114,193,240);} p.ten { background-color: rgb(84,182,237);} p.eleven { background-color: rgb(48,170,233);} p.thirteen { background-color: rgb(0,160,230);} p.fourteen { background-color: rgb(0,136,221);} </style> </head> <body> <h1>pH Scale</h1> <p class="fourteen">14.0 VERY ALKALINE</p> From this source What is the difference between Django and Html? What function or setting do I have to find in Django to make any framework of html/css within a fraction of seconds since html and css alone to make such framework is hugely tedious task? -
Django Wagtail Pages -1
I flushed my database to reset my website in my Django Wagtail project and now I cannot add any page to my Wagtail website. Here you can find the screenshot. There is no option to add pages. Any solutions? Or do I have to create a new project and reset everything? -
Django, ModelFormField: using evaluated queryset several times
I have a ModelFormSet with ~5 forms; each copy of form has a ModelChoiceField with all fields of one model Distance, ~1000 items. I want to make just one evaluation of the queryset Distance.objects.all(), not 5 such queries, and use its result in each form. How can I do it? I tried to provide the argument form_kwargs={'distances': models.Distance.objects.all()} to a ModelFormSet; but it appears that this queryset is still evaluated for each form copy. Can I ask Django to do it just once? -
How to make Django, type annotations, and Flake8 work together?
I'm using Django / DRF. I want to write type-checked Python. I also want linting. Django's model structure involves creating a manager class for every model, and assigning an instance of the manager class to the model's objects member. Since I'm using type annotations, the manager class's methods now also includes a reference to the model. This causes flake8 to report an error in one or the other. Here is an example: class UserManager: def create_user(email: str) -> User: ... ^^^^ [flake8] F821: undefined name 'User' class User: objects = UserManager() And if I flip them around, I get: class User: objects = UserManager() ^^^^^^^^^^^ [flake8] F821: undefined name 'UserManager' class UserManager: def create_user(email: str) -> User: ... What do people do to write typed, linted Django code? -
Django - Editable ModelAdmin, TabularInline with ManyToMany relationship
I have the following models: class Attribute(models.Model): name = models.CharField(max_length=16) ... class BaseAttribute(models.Model): attribute = models.ForeignKey(Attribute, on_delete=models.CASCADE) value = models.FloatField() class AttributedObject(models.Model): name = models.CharField(max_length=16) description = models.CharField(max_length=256) base_attributes = models.ManyToManyField(BaseAttribute, blank=True) I'm trying to create inlines for AttributedObjects to have multiple BaseAttributes. class BaseAttributeInline(admin.TabularInline): model = BaseItem.base_attributes.through class BaseItemAdmin(admin.ModelAdmin): inlines = [BaseAttributeInline] exclude = ('base_attributes',) class Meta: model = BaseItem However, in the admin, it is just showing a selection for BaseAttributes (or creating new ones) instead of the individual fields of the BaseAttribute. I would like the inline to show a selection for the Attribute and a float value input as well as reuse existing BaseAttributes that already have identical values. How can I achieve this, or will I have to abandon the many to many relationship? -
Django Generic CBV Model plus its related other Model set?
I have a generic Django CBV which looks like this: class EditQuestion(LoginRequiredMixin, UpdateView): """ Edit a specified question """ model = Question fields = ['question_text'] template_name = 'clients/business/update_question.html' def get_queryset(self): queryset = super(EditQuestion, self).get_queryset() queryset = queryset.filter(business__client=self.request.user) return queryset def form_valid(self, form): form.save() return HttpResponseRedirect(reverse('clients:question_list')) Each question has an answer_set from a different model called Answer. How do I include each Question's answer_set in the same UpdateView? let's say the related name was answer_set: I want to essentially change fields to fields = ['question_text', 'answer_set'], but I know that is incorrect. I want to have one form include both the Question AND its set of answers(from a different model) How would I do that? I assume people have to do this all the time in their forms. -
How to save current user as an author in Django when submitting form
When I post a new store, the current user is supposed to be stored as an author with the below codes. However, it only works in Django admin. I'm actually using a custom CMS, which works with Django forms, so it works like the admin does. I think I need to make the below codes to work in models.py so that it can work in both Django admin and my CMS. Can anyone explain how can I do that? admin.py @admin.register(Store) class StoreAdmin(SummernoteModelAdmin): ... def save_model(self, request, obj, form, change): if getattr(obj, 'author', None) is None: obj.author = request.user obj.save() -
How to refer to a Django model in Sphinx docs?
I have in my conf.py of Sphinx intersphinx_mapping = { 'django': ('http://docs.djangoproject.com/en/dev/', 'http://docs.djangoproject.com/en/dev/_objects/'), # 'python': ('https://docs.python.org/3.5', None), } Now I am trying to refer to a Django model: """For Django :django:class:`django.forms.fields.ChoiceField`.""" It does not produce the right thing in the HTML. How to do this? -
Apache + Wsgi + Django 2.1 + Virtualenv 3 = Fatal Python error: Py_Initialize: Unable to get the locale encoding
So I have had success deploying django applications on python 2.7, but this is my first time trying it with 3.6 and django 2.1, and for some reason apache keeps getting me this error: [Thu Sep 06 17:23:13.591266 2018] [core:notice] [pid 18011] AH00051: child pid 18164 exit signal Aborted (6), possible coredump in /etc/apache2 Fatal Python error: Py_Initialize: Unable to get the locale encoding I have looked over the internet but cant find a solution. Here is my VirtualHost: Listen 8081 <VirtualHost *:8081> ServerName mysite.com WSGIDaemonProcess Project python-home=/home/happyuser/myproject_tst/venv python-path=/home/happyuser/myproject_tst WSGIProcessGroup myproject WSGIScriptAlias / /home/happyuser/myproject_tst/myproject/myproject/wsgi.py ErrorLog /home/happyuser/apache_errors.log Alias /static /home/happyuser/myproject_tst/myproject/static/ <Directory /home/happyuser/myproject_tst/myproject> <Files wsgi.py> Require all granted </Files> </Directory> <Directory /home/happyuser/myproject_tst/myproject/static> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> LogLevel debug </VirtualHost> Any suggestion is much appreciated -
How to create a viewer field for relay in django-graphene root schema?
How to create a viewer field for react-relay in graphene-django? This does not work like intended. I am using graphene-django v.2.2. Django 2.1. React-relay v1.7.0-rc.1. // landingpage.schema.py class CollectionNode(DjangoObjectType): class Meta: model = Collection interfaces = (relay.Node, ) class Viewer(graphene.ObjectType): class Meta: interfaces = [relay.Node, ] collection = graphene.Field(CollectionNode) def resolve_collection(self, info, **kwargs): return Collection.objects.all() class Query(object): viewer = graphene.Field(Viewer) def resolve_viewer(self, info, **kwargs): return Viewer() # or info.parent_type -
<title> {% block title %} Some text {% endblock %} </title> is not override by other page?
This is my base file {% load static %} {% include "feed/header.html" %} {% block content%} {% endblock %} {% include "feed/footer.html" %} This is my header which includes title: {% load staticfiles %} <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title> {% block title %} Home {% endblock %} </title> So when I try to override title in my detail page then it shows the title of header always i.e. Home(not change) but not the title of detail page which I override. following is the code which I used in Detail page: {% extends 'feed/base.html'%} {% block title %} Details {% endblock %} {% block content %} some views {% endblock %} So help me to figure out this problem. -
Method "POST" not allowed with Django Rest Framework
I'm trying to create a JSON API compliant rest service using Django Rest Framework JSON API: https://django-rest-framework-json-api.readthedocs.io/en/stable/index.html I think I'm stuck at the Django Rest Framework level, but I am not certain. I think the GET request is working, but the POST is not because I get this response: $ curl -H 'Accept: application/vnd.api+json; indent=2' -X POST http://localhost:8000/greeters/ { "errors": [ { "detail": "Method \"POST\" not allowed.", "source": { "pointer": "/data" }, "status": "405" } ] } But the GET is fine: $ curl -H 'Accept: application/vnd.api+json; indent=2' http://localhost:8000/greeters/ { "data": {} } I've looked at other posts and the tutorials and it seems like I've missed something in my code that is not popping out at me. Hopefully, it will pop out at someone else who has more experience with Djang and Django Rest Framework. Thank you for your time :) Here's my code: my_project/urls.py from django.conf.urls import include from django.contrib import admin from django.urls import path, re_path urlpatterns = [ path('admin/', admin.site.urls), re_path(r'^greeters/', include('greeter.urls')), ] greeter/urls.py from django.conf.urls import url, include from rest_framework import routers from .views import GreeterViewSet ROUTER = routers.DefaultRouter() ROUTER.register(r'^', GreeterViewSet) urlpatterns = [ url(r'^', include(ROUTER.urls)), ] greeter/views.py from rest_framework import viewsets from .models import … -
how to provide a backup database connection details in django?
Currently in my application I have AWS RDS database connection settings in my settings.py file. I also have postgresql instance running on digital ocean. I wish to use digital ocean postgresql when AWS is not available. How can this be achieved in Django application. -
Django - Display a list of calculated fields in a template
I am passing a list of querysets and a list of total prices to my template. I am using the reverse relationship of my Requisition Table to display each line that exists for that requisition. I am passing the total price of the requisition(adding all the lines prices together). I am trying to display in a table format each record with the cumulative price at the bottem next to a submit button. My initial thought was to obviously iterate over the list but that is causing me a problem because I would be nesting three for loops so it is not displaying the result like intended. pending_action.html <h1>Pending Action</h1> {% for req_header in req_header_list %} <div class="accordion" id="accordionExample"> <div class="card"> <div class="card-header" id="headingOne"> <h5 class="mb-0"> <button class="btn btn-link" type="button" data-toggle="collapse" data-target="#req{{ req_header.id }}" aria-expanded="false" aria-controls="collapseOne"> {{ req_header }} </button> </h5> </div> <div id="req{{ req_header.id }}" class="collapse" aria-labelledby="headingOne" data-parent="#accordionExample"> <div class="card-body"> <table class="table"> <tr> <th>Line</th> <th>Description</th> <th>Quantity</th> <th>Total Price</th> <th>Status</th> </tr> {% for line in req_header.par_req_line.all %} <tr> <td>{{line}}</td> <td>{{line.description}}</td> <td>{{line.quantity}}</td> <td>{{line.total_price}}<td> <td>{{line.status}}</td> </tr> {% endfor %} <tr> <td> <form action="#" method="POST"> <input type="submit" value="Submit"> </form> </td> <td></td> <td></td> <td> <!--WANT TO DISPLAY THE TOTAL PRICE PER REQUISITION HERE {{price_list.0}} </td> … -
Celery worker ImportError: No module named 'project'
While I tried to start the worker I got a issue: ImportError: No module named 'project' Traceback (most recent call last): File "/usr/local/bin/celery", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python3.5/dist-packages/celery/__main__.py", line 16, in main _main() File "/usr/local/lib/python3.5/dist-packages/celery/bin/celery.py", line 322, in main cmd.execute_from_commandline(argv) File "/usr/local/lib/python3.5/dist-packages/celery/bin/celery.py", line 496, in execute_from_commandline super(CeleryCommand, self).execute_from_commandline(argv))) File "/usr/local/lib/python3.5/dist-packages/celery/bin/base.py", line 273, in execute_from_commandline argv = self.setup_app_from_commandline(argv) File "/usr/local/lib/python3.5/dist-packages/celery/bin/base.py", line 479, in setup_app_from_commandline self.app = self.find_app(app) File "/usr/local/lib/python3.5/dist-packages/celery/bin/base.py", line 501, in find_app return find_app(app, symbol_by_name=self.symbol_by_name) File "/usr/local/lib/python3.5/dist-packages/celery/app/utils.py", line 359, in find_app sym = symbol_by_name(app, imp=imp) File "/usr/local/lib/python3.5/dist-packages/celery/bin/base.py", line 504, in symbol_by_name return imports.symbol_by_name(name, imp=imp) File "/usr/local/lib/python3.5/dist-packages/kombu/utils/imports.py", line 56, in symbol_by_name module = imp(module_name, package=package, **kwargs) File "/usr/local/lib/python3.5/dist-packages/celery/utils/imports.py", line 104, in import_from_cwd return imp(module, package=package) File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 986, in _gcd_import File "<frozen importlib._bootstrap>", line 969, in _find_and_load File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked ImportError: No module named 'project' I'm using a celery and redis in ubuntu16.04 .Following are my processing steps: First install celery and redis: pip install -U celery[redis] sudo apt-get install redis-server When I use: ps aux|grep redis I can see that redis is listing port 6379 Second in the project.setting add: #Broker BROKER_URL … -
I can't figure out why my Ajax does not work with Django(like button)
I want to implement my Ajax with my Django project, meaning that I don't want users to see a reloaded page after they click on the button. But something went wrong and my ajax shows the incorrect number of likes. For example, if I had 3 likes and I would add another one it would show 4 likes, but when I click again it shows 2 likes. What goes wrong and how can I prevent this? Here are all my files: views.py class PostLikeAPIToggle(APIView): authentication_classes = (authentication.SessionAuthentication, ) permission_classes = (permissions.IsAuthenticated,) def get(self, request, slug=None, format=None): #slug = self.kwargs.get("slug") post = get_object_or_404(Post, slug=slug) user = self.request.user updated = False liked = False if user.is_authenticated: if user in post.likes.all(): liked = False post.likes.remove(user) else: liked = True post.likes.add(user) updated = True data = {"updated": updated,"liked": liked} return Response(data) My AJAX(or JavaScript) <script type="text/javascript"> $(document).ready(function(){ function Updating(btn, newCount, verb){ btn.text(newCount + " " + verb) } $(".like-btn").click(function(e){ e.preventDefault() var this_ = $(this) var likeUrl = this_.attr("data-href") var likeCount = parseInt(this_.attr("data-likes")) var addLike = likeCount + 1 var removeLike = likeCount - 1 $.ajax({ url:likeUrl, method: "GET", data: {}, success: function(data){ console.log(data) if (data.liked){ Updating(this_, "", addLike) } else { Updating(this_, "", removeLike) … -
Django: How to searialize a formset
Django: How can i serialize a formset so that i can send the data as JSON. I know how to do for a single form using django-remote-forms. It converts the form to a dict and later I can dump as JSON. -
Graphene-Django: In schema combine Query-objects (only takes first argument)
I am trying to combine multiple Query schemas located in different apps in Django 2.1. Using graphene-django 2.2 (have tried 2.1 with same problem). Python 3.7. The Query class only registers the first variable. As an example shop.schema.Query. import graphene import graphql_jwt from django.conf import settings import about.schema import shop.schema import landingpage.schema class Query(about.schema.Query, shop.schema.Query, landingpage.schema.Query, graphene.ObjectType): pass class Mutation(shop.schema.Mutation, graphene.ObjectType): token_auth = graphql_jwt.ObtainJSONWebToken.Field() verify_token = graphql_jwt.Verify.Field() refresh_token = graphql_jwt.Refresh.Field() schema = graphene.Schema(query=Query, mutation=Mutation) Why is it like this? Have something changed with classes in python 3.7? The graphene tutorial says this will inherit for multiple... class Query(cookbook.ingredients.schema.Query, graphene.ObjectType): # This class will inherit from multiple Queries # as we begin to add more apps to our project pass schema = graphene.Schema(query=Query) I am exporting my schema to schema.json for using it with react relay. I do find my object "collection" Query schema from landingpage(the 3. variable). Relay returns: ERROR: GraphQLParser: Unknown field collection on type Viewer. Source: document AppQuery file: containers/App/index.js. Is it a problem with Relay reading my schema.json? -
Setup Django project on Heroku: database permission error
I'm using the official heroku-django package for my project. I set all my environment variables, created a database etc. But I'm always getting this error. Does someone know how to fix this? self = <django.db.backends.utils.CursorWrapper object at 0x7f4633ed0080> sql = 'CREATE DATABASE "d94aioff89slk8" ', params = None ignored_wrapper_args = (False, {'connection': <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7f4633ed06d8>, 'cursor': <django.db.backends.utils.CursorWrapper object at 0x7f4633ed0080>}) def _execute(self, sql, params, *ignored_wrapper_args): self.db.validate_no_broken_transaction() with self.db.wrap_database_errors: if params is None: > return self.cursor.execute(sql) E psycopg2.ProgrammingError: permission denied to create database .heroku/python/lib/python3.6/site-packages/django/db/backends/utils.py:83: ProgrammingError Important part of my app.json: "environments": { "test": { "addons": ["heroku-postgresql"], "scripts": { "test-setup": "python manage.py collectstatic --noinput", "test": "pytest" } } }, -
type object 'ProductForm' has no attribute 'cleaned_data' django
I am making a form using Django 2.0.x and Python 3.6 and I am getting an error I'm not sure what's going on, can someone help me out? Thanks! Product/forms.py from django import forms from .models import Product class ProductForm(forms.ModelForm): title = forms.CharField(label='', widget=forms.TextInput(attrs={"placeholder": "Your title"})) description = forms.CharField( required=False, widget=forms.Textarea()) class Meta: model = Product fields = [ 'title', 'description', ] Product/views.py from django.shortcuts import * from django.http import * from .models import Product from .forms import ProductForm import hashlib # Create your views here. def home_view(request,slug,*args,**kwargs): form= ProductForm(request.POST or None) try: productobject=Product.objects.get(id=1) except Product.DoesNotExist: raise Http404 if form.is_valid(): newProduct=Product.objects.create( title = "jose", description=ProductForm.cleaned_data.get["description"] ) if newProduct: return HttpResponseRedirect("/) else: newProduct = ProductForm() context= { "sampletext": "text", "form": form, "productobject":productobject, } return render(request, "home.html",context) The code is giving me this error type object 'ProductForm' has no attribute 'cleaned_data' -
Django Python: Can't access JS object passed via AJAX from Python QueryDict
In this Django project I'm building, I have data going back and forth between server and client via javascript and python using AJAX. For convenience I devised a config object in JS to carry over important parameters the server and responding JS need to know. On the Python side I am unable to access this object because it is None, but printing the object out to the JS console before sending and printing the POST object out to the Py console both show something is there. I don't understand why accessing the JS object (not it's memebers) in the QueryDict comes back as None. # JavaScript var objConfig = { param1: "more text data", param2: "more text data", param3: "more text data", }; console.log(objConfig); $.ajax({ type: "POST", url: url, data: { csrfmiddlewaretoken: strCsrfToken, strTextData: strTextData, objConfig: objConfig }, success: callback }); # JS console output: # Object {param0: "more text data", param1: "more text data", param2: "more text data"} # Python def DoTheThing(response): print(response.POST.get('strTextData')) print(response.POST.get('objConfig')) print(response.POST) print(response.POST.get('objConfig[param0]')) # Python console output: # Text data being sent to server. # None # <QueryDict: {'csrfmiddlewaretoken': ['...'], 'strTextData': ['Text data being sent to server.'], 'objConfig[param0]': ['more text data'], 'objConfig[param1]': ['more text data'], 'objConfig[param2]': …