Category "django"

Serializing reverse relationship of a ForeignKey with a DRF ModelSerializer

I'm trying to generate a data structure following this sample: [ { "name": "groupname", "key": "grouping1", "base_templates": [ { "i

Setting up gunicorn.service [Service] for Django app

Following the documentation and online tutorials on setting up my gunicorn.service results in ModuleNotFoundError: No module named 'my-app' when I run sudo syst

button function doesn't work without any error - django

So i want to make models form to upload file mp3. I was copy the code from website, but suddenly it's not work. there's no error message in terminal or console

Why my Django admin is not loading with css?

I have developed a web app in Django and deployed it then I found out that admin page is not loading with CSS. I was gettting the admin page with css in local s

Get NGINX ip address in docker in Django settings.py for Django-debug-toolbar

I have a dockerized DRF project with installed NGINX in it. All works fine except one thing: Django debug toolbar requires INTERNAL_IPS parameter to be specifie

PermissionError: [Errno 13] Permission denied: '/manage.py'

I am trying to run the following command in docker-composer, to start project with django-admin: docker-compose run app sh -c "django-admin startproject app ."

Django ckeditor is removing space around <a> tags

I'm using django-ckeditor with this config: 'enterMode': 2, 'forceEnterMode': 'true', 'basicEntities': 'false', 'fillE

Django deleting querysets with paging, not catching all parts of the set

I have a bit of a strange problem that I'm not quite able to explain. I have a django project with some old, stale objects lying around. For example, lets say

How to create short uuid with Django

I have a model and UUID as primary key field. UUID id is way too long. I'd like to have it short similar to YouTube. class Video(models.Model): id = models

Django EmailMessgae() Error: MIMEPart.__init__()

This is my views file: I have made a token file to generate a link and info file for details like EMAIL_HOST_USER and etc. current_site = get_current_s

"digitalocean" droplet password changing broke the website (502 Bad Gateway nginx/1.10.0 (Ubuntu))

I have changed the password of the digitalocean droplet then after that the website is not working at all and the api's for the mobile application is not workin

Getting "curl: (92) HTTP/2 stream 1 was not closed cleanly: INTERNAL_ERROR (err 2)"

I have a Django app which returns a large JSON while calling an API. The problem is when I'm requesting the data, the data itself is truncated which is crashing

Django: How to enforce UniqueConstraint with parent and child models

Say I have the following models: class ParentModel(models.Model): parent_field_1 = models.CharField(max_length=10) parent_field_2 = models.CharField(max

Why is request.user is anonymous in Django RedirectView?

There are a lot of questions similar to this one, but none quite capture the situation I am in. I am coding a Django/ React app and I have integrated with Spoti

when running tests in django and PostgreSQL DB can't create database

I'm having a problem with running unit tests in django while using ElephantSQL, when running command python manage.py runserver everything works just fine, I'm

Django - How do i check whether a date has expired inside filter condition

How do i check whether a date has expired or not with respect to today in filter condition. eg: task = Task.objects.filter(job=obj, status__in = ["in-progress"

How to pass request object from one serializer class to other serializer class in Django

I want to access userId of current logged-in user. for that i need to pass the request object from one serialiser to another. Here's my code class ThreadViewSer

Django s3: 403 Access Denied, and generating URLs

I wish to allow registered users of a Django app to upload and view files to an s3 bucket. With the help of the first commenters on this question and this answe

How to search and filter on multiple related models?

I am creating an search and filter system in which user can type and search related courses and institutions. This is my model structure: Model Structure: I

Django - Create downloadable Excel file using Pandas & Class Based View

I'm relatively new to Django and have been looking for a way to export my DataFrame to Excel using Pandas and CBV. I have found this code: from django.http impo