Category "django"

Django: Renaming Models, M2M Table not renamed

TLDR: Models moved to a new app. After migrating M2M relation refers to table that does not exist. Previous M2M table was not renamed. Django Version: 3.2.3 Sce

Looking in links: /usr/share/pip-wheels

I was using a virtualenv in Pythonanywhere and now after cloning my repo I tried to install all the packages by using this command pip install -r packageName/r

How can i exit the python shell to the terminal in Pycharm?

For example, I wrote the code; SyntaxError: invalid syntax >>> python manage.py command File "<console>", line 1 python manage.py command* t

How to pass a queryset from django to javascript function?

I want to pass a queryset from a view to a javascript function throught the template: my view.py: def myview(request): lista=Mymodel.objects.filter(ti

How can I Generate 10 Unique digits in Model Form and Pass Form Context Variable in Django Class Based ListView

I am new to Django Class Based Views and I am working on a project where on the template I want to have Form for creating customer accounts on the left and list

serving media files in Django for Production

I want to serve all types of media files in my Django Project I used Whitenoise to server static files and static files are working well but I'm having issues w

Django admin display many-to-many field as links

Trying to get my Django admin to display a list of related objects as hyperlinks to those objects. These objects are related through a many-to-many relationship

Writing a Django migration that adds a unique field based off another field

I have a model SessionCategory with a unique field name. Certain pivotal instances of this model are referenced by name; the only problem is that name is also e

Many tasks at once in Celery?

If we use celery beat and run about 1000 tasks by same crontab schedule, will tasks run one by one or some tasks will not run (cause of out of time)? redis as M

Why am I getting "No application configured for scope type 'web socket'" still?

I am following , django channels 2 chat app tutorial I am at the part "writing your first consumer", I exactly did what is in tutorial, you can find my code he

How to get django queryset results with formatted datetime field

I've Django model which has foreign keys associated with other models. Each model is having same field names(attributes) created_at and updated_at In every dja

Unable to install Pillow for Django App using Terminal on Namecheap Shared hosting

I was going to deploy my Django App on Namecheap shared hosting. My app needs Pillow to be able to run perfectly. But while installing pillow using pip install

Django / error : Object of type *** is not JSON serializable

I have seen this is a common mistake and there are a lot of entries in StackOverflow, but I can't connect the dots on this one. in my views.py, this one works d

Object of type <> is not JSON serializable Django REST Framework

I am trying to create a search function inside my class-based view using Django Rest Framework, but it does not seems to work. when I try to search for some cus

Django : local variable 'date' referenced before assignment but I import it

I am building a script that use the datetime module : def workspace_detail(request, token): yesterday = date.today() - timedelta(days=1) tomorrow = date.today

Why should I set max_length when using Choices in a Django model?

In the official Django 2 tutorial I found this: from django.db import models class Student(models.Model): FRESHMAN = 'FR' SOPHOMORE = 'SO' JUNIOR

Is it possible to submit multiple forms at once using Django views?

What I want to accomplish is to be able to submit multiple forms contained on one page. What I have currenlty done is supplied a view that returns 8 forms. Is i

csrf cookie not set on linux

I know this question is quite popular, before asking it, I researched all the previous questions and their answers, but never found a solution for myself. My pr

Visual Studio Code: Intellisense not working

My Visual Studio Code's Intellisense is not working properly. Every time I try to use it with Ctrl + Shift, it only displays a loading message. I'm using Python

pytest-django could not find a Django project

Trying to configure pytest with django, the project already has a lot of test not written with pytest (written with unittest) but I am trying to get them run wi