Django.fun

Questions & Answers about Django, page 2

Datatables| Django, sorting, paging and searching with DRF

I have a Datatable that's working perfectly, and I wanted Server-side process to be true and not client-side. But when I enable server-side the sorting, paging and search became faulty. TestCase: https://codepen.io/TheNerdy97/pen/gOvNeeo?html-preprocessor=pug I'm using this module <a …

django-picklefield changes structure after upgrade

I'm migrating a Django app from 1.11.16 to 4.0.5 and django-picklefield will be migrated also from 2.0 to 3.1 . A django object has the following line: from picklefield.fields import PickledObjectField class A(models.Model): ... log_list = PickledObjectField(default=list) . Using …

Django Rest Framework static file blocked by CORS

Can someone help me, because I can't do anything with CORS. I have DRF server with corsheaders installed. The settings are INSTALLED_APPS = [ ... 'corsheaders', 'django.contrib.staticfiles', ... ] MIDDLEWARE = [ 'corsheaders.middleware.CorsMiddleware', ... ] CORS_ORIGIN_ALLOW_ALL = True CORS_ALLOW_HEADERS = …

django sitemap for static react routes (error : NoReverseMatch at /sitemap.xml/)

i want to implement sitemap for static react routes and I get this error: Reverse for 'contact' not found. 'contact' is not a valid view function or pattern name. I added …

Im trying to implement a delete button using django and vue js

Im trying to implement a delete button using django and vue js but im running into an error 500 and i cant seem to understand why ? i know it means my call isn't working <img src="https://i.stack.imgur.com/RdVrs.png" …

DRF Model Permission denying access to authenticated user

I'm getting a permission denial error but, if I'm understanding things correctly, the permissions should already have been assigned. …

Choose Front-end and Backend for multipurpose website( Social Network + ecommerce (like facebook has Market)

I have been reviewing the suggestion of using Django for backend(api) and using Reactjs for front-end. These can help the platform run smoothly, fast and secured.However, I would like to know your suggestion of choosing technologies for building that platform …

How do i become a forex web application developer [closed]

i am web developer with intermediate knowledge in Python, Django , javascript, Html and css. i will like to start building web applications for forex trading but i dont't have any idea on how to start and i haven't seen …

Not able to apply redis lock on celery workers

I am trying to replace django memcache’ to redis lock and getting Connection reset error`

How to filter comparing two informations from the same Django model

I have a MedicalCertificate model like this: class MedicalCertificate(models.Model): needs_leave = models.BooleanField() date = models.DatetimeField() days_off = models.IntegerField() And I need to filter the active medical certificates, which are: date + days_off &gt;= datetime.now() I tried to use F(), …

Python3 import error smart_unicode django

This is my first time ever trying to run a py script I have a script to auto import to android studio some translations. I installed python 3.10.5 and pip and trying to run a script. I also installed Django …

How to perfom CRUD Operation in Flutter & Postgres

I want to perfom CRUD Operation Postgres but with a flutter app, so that my Django app can share data with Flutter.

Python Django convert timestamp from UTC to local timezone

Im am working with Django + DRF, to develop a REST API. I have configured the django settings to work with the timezone support on: USE_I18N = True USE_L10N = True USE_TZ = True As previously mentioned, my database …

Plotly in Django should I use Dash?

I am a reasonably experienced amateur python coder. With this site's help I have fought my way through, celery, channels, websockets, NGINX, docker etc etc to produce a website which controls my astronomy dome and some house automation. Part of …

Store extra data like refresh_token when signing up via access_token

I am trying to signup using access token for google. My frontend is next.js with next-auth.js fetching the access_token, refresh_token, etc. I am using python social auth with Django to persist the user information. I use the access_token provided by …

Pass Django list as argument to Javascript

I have a list passed through the context into the html page of a Django project which I want to read inside of a .js which contains chartjs code. The problem is that .js is reading as string and not …

Pylance, functions not defined

I have a simple code with 3 functions. the first one get some values from the 2 others to check some conditions, but I get an error from Pylance saying the functions sub1 and sub2 are not defined. any clues? …

Template variables doesn't updates after redirect in Django?

I am building simple django app where I want to do some parsing when user click button on the frontend. I have template variable {{ parsing }} which I am using inside index.html to disable button for parsing when user …

Python NameError: name '_mysql' is not defined

I am trying to have a working ubuntu server with Python, Django and MySQL. But when I switch from SQLite to MySQL and trying to reach my server I get the following error &quot;NameError: name '_mysql' is not defined&quot;. It …

How to get the Current User IP in Python / Django

I am trying to capture the IP Address and the System Name of the current Login user during the login Process. I Use following code for the same: import socket system = socket.gethostname() IPAddr = socket.gethostbyname(system) It works fine …

1 2 3 4 1806 1807

Tutorials

Современный Python: начинаем проект с pyenv и poetry

Настройка проекта Python — виртуальные среды и управление пакетами

Использование requests в Python — тайм-ауты, повторы, хуки

Понимание декораторов в Python

ProcessPoolExecutor в Python: полное руководство

map() против submit() с ProcessPoolExecutor в Python

Понимание атрибутов, словарей и слотов в Python

Полное руководство по slice в Python

Выпуск Django 4.0

Безопасное развертывание приложения Django с помощью Gunicorn, Nginx и HTTPS

Автоматический повтор невыполненных задач Celery

Django REST Framework и Elasticsearch

Докеризация Django с помощью Postgres, Gunicorn и Nginx

Асинхронные задачи с Django и Celery

Релизы безопасности Django: 3.2.4, 3.1.12 и 2.2.24

Выпуски исправлений ошибок Django: 3.2.3, 3.1.11 и 2.2.23

Эффективное использование сериализаторов Django REST Framework

Выпуски безопасности Django: 3.2.2, 3.1.10 и 2.2.22

Выпущенные релизы безопасности Django: 3.2.1, 3.1.9 и 2.2.21

Обработка периодических задач в Django с помощью Celery и Docker

View all tutorials →