Category "django"

Django superuser doesn't have permission to delete models

I am working on upgrading a Django website from Django 1.8 to Django 2.2 and have come across a problem when trying to delete an object from the Django admin ch

How to manually customize parameters of DRF views using drf-yasg Swagger?

I am using drf-yasg package to integrate Swagger with DRF. As documentation said I used @swagger_auto_schema decorator to manually customize auto-generated endp

Displaying child records based on parent id from URL

I have one model Dataset and another one called DatasetReview, where DatasetReview has a foreign key connection to Dataset. I would like to display all of the D

Django ModuleNotFoundError

I can't make a simple Django project work at all. I get the same error as listed in this question which I found: Python/Django =- ModuleNotFoundError: No modul

How to Crop Images in a Django Application *JavaScript Issue*

I am having issues with my JavaScript code, and I am trying to get the image crop (picture) below to pop up but when I click the Choose File button but nothing

'ProgrammingError: function avg(character varying) does not exist' - Django project

I have recently deployed a Django project to Heroku. While testing out the functionality in the browser, I've come across a new error when attempting to render

Rendering a string in django template as json object

I have a angular app that sends json data to a django backend. The django app save the json data in to a DB and later pulls it out to send it back to the angula

Check if user has a permission with specific codename in django

I am trying to check if a user has a permission, which I have defined in the class Meta of the model, with a specific codename. At the moment I have: if reques

How to add username to the filefield?

I am making use of file fields in my model and I want it to be saved as username_field.jpeg (or whatever format it is in), for example for rent_agreement I want

How to POST multiple objects in one JSON request?

I am using django-rest-framework and recently I encountered a problem. I need to post such request and get 2 objects created: { "lease": 28, "date": [

Django async testing: Cannot operate on a closed database

I was following this tutorial on testdriven.io in order to test some async functions in django and I need to add som decorators in order to enable my async test

django 'str' object has no attribute '_meta'

Sorry for my English. I have some data from another server, but I need to output this data like JSON. if i print response in console: { 'responseStatus': {

Mongoengine raw find_and_modify query gives "Must either update or remove" exception

I am using Django + mongoengine I want to update the books (embedded document) count in my Bookscollection document. I want the update query to return the full

How can I use a third-party API which has basic authentication (username, password) in Django?

I have one third-party API (a URL). To access that URL I have to give basic authentication which is username and password. How can I get data from that API usin

AssertionError at /graphql/ Query fields must be a mapping (dict / OrderedDict) with field names as keys or a function which returns such a mapping

I am new to django and graphql, I am trying use graphql in django using the the instructions given in this site. https://docs.graphene-python.org/projects/djan

Error loading MySQLdb Module 'Did you install mysqlclient or MySQL-python?'

I am using windows 10 command line for a django project using python34 however, I am facing difficulties with SQL. I have already installed mysqlclient using

How to check if celery task is already running before running it again with beat?

I have a periodic task scheduled to run every 10 minutes. Sometimes this task completes in 2-3 minutes, sometimes it takes 20 minutes. Is there any way using

bootstrap datepicker not working in django

i am trying to integrate bootstrap datepicker but its not working setting.py: INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contri

Django Allauth migration error

I've run across this issue before and I think I had to go into the library installed by pip to manually delete the migrations to fix it. Does anyone have a bet

Django Allauth migration error

I've run across this issue before and I think I had to go into the library installed by pip to manually delete the migrations to fix it. Does anyone have a bet