Skip to content
Advertisement

Tag: django

Django: populating many to many field using modelformset_factory

I try to populate a many-to-many field. The Relationship exists between the Menus and Course Model. I added some custom fields to the M2M Table, so I can store the order of the courses and their type (i.e. Starter, Appetizer, etc.). To get a dynamic webform, I use modelformset_factory with the python-formset-js-improved pip package (https://pypi.org/project/django-formset-js-improved/). following the logic in my

Python Django Rest – Return extra field with lowest, highest and average values of some other field

I’m new to Django and APIs in general and I want to create a Django based API using Django Rest Framework. Here’s what I want to do: Endpoint to age range report: Response: Endpoint to salary range report: Response: I have two apps, employees and reports. Here’s employees/models.py: Here’s employees/serializers.py: I’m not sure how to create my views and serializers

Object is not subscriptable python error django

I have this function where i am using models ‘Start’ and ‘End’ that contain fields latitude and longitude.. and I am trying to match them with a field called elements that I am using subscript to extract the start_id and end_id and match them with ‘Start’ and ‘End’ The function in question that is giving me a subscript error is:

Django: Horizontal scaling with a single database

I have a single django instance about to hit its limits in terms of throughput. Id like to make a second instance and start scaling horizontally. I understand when dealing with database read replicas there is some minimal django configuration necessary, but in the instance of only using a single database: is there anything I need to do, or anything

Need to have the correct url path in Django

I am trying to get my Django app to point to the correct URL in my chatserver/urls.py file. I am getting this error when I start my django app: Using the URLconf defined in chatserver.urls, Django tried these URL patterns, in this order: admin/ join [name=’join’] The empty path didn’t match any of these. This is my chatserver/urls.py file: And

Advertisement