Questions tagged [django-4.0]

Django 4.0 is a version of the Django framework, released in December 2021. Please only use this tag if your question relates specifically to this version.

Django 4.0 works with Python 3.8, 3.9, and 3.10.

Here are some of the salient features of Django 4.0:

Django 4.0 was released in December 2021 and was supported until April 2023.

88 questions
1
vote
1 answer

Why can't I see the image?

project name: mypage application name: hoge database: sqlite3 Hmmm, I was able to upload the image. 'mypage/media/uploads' (models.py) class Staff(models.Model): """shop staff""" name = models.CharField('display_name', max_length=50) …
yoshitaka okada
  • 113
  • 1
  • 12
1
vote
1 answer

GeoDjango Admin displaying openlayers map instead of open street map in Admin

i am have enabled everything needed to work with spatial data at the database and django setting level, my profile model has a default_location field that is a PointField. as shown below. from django.contrib.gis import models class…
Brian Obot
  • 336
  • 4
  • 16
1
vote
1 answer

ImportError: cannot import name 'url' from 'django.conf.urls django #Python #Django #VisualStudioCode

I have been trying to write a simple django website. Unfortunately I am having errors with trying to import bayaan.urls (the app) into the urls.py(of the project). This is the error: (test) C:\Users\---\Documents\------\Django\apps\School>python…
0
votes
1 answer

Django - setting up Server-sent Events with Channels: Unhandled Exception: SseConsumer() missing 2 required positional arguments: 'receive' and 'send'

I have an existing Django Channels setup that is working with websockets and I have to add another endpoint to support SSE. I'm following an example from here https://channels.readthedocs.io/en/stable/topics/consumers.html to set up a consumer using…
Sthe
  • 2,575
  • 2
  • 31
  • 48
0
votes
0 answers

Upgraded to Django 4.0 and receiving ImproperlyConfigured: Could not find notifications.PushNotification

I inherited this code from the previous Software Engineer. I am still new to Python and Django. In my development environment I updated Django to 4.0. I am able to resolve most issues except one for notifications. The error: File…
Debbie
  • 11
  • 2
0
votes
0 answers

TypeError: argument 2 must be a connection, cursor or None in psycopg2

Getting TypeError: argument 2 must be a connection, cursor or None Below is the stack trace: File "/root/python3/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55 response = get_response(request) File…
user2580
  • 239
  • 5
  • 13
0
votes
1 answer

How to solucionate the error to Upgrade project to Django 4.2.3

I have a Django project in the 3.1.2 version. However, I need upgrade it to a new version, to 4.2.3. I´m having the following message when I upgrade the project. How to solucionate this? "django.core.exceptions.ImproperlyConfigured: Cannot import…
gPxl
  • 95
  • 14
0
votes
1 answer

Increase Django CSRF tocken longevity

I get lots of Django CSRF errors due to timeout. In normal operations, the form submissions are OK. But, if I leave the page for a few hours and then submit it, it will fails with the Forbidden (403) CSRF verification failed. Request…
ar2015
  • 5,558
  • 8
  • 53
  • 110
0
votes
1 answer

django rest framework: Getting "This field may not be null." with FloatField even with blank=True

Here dummy code to show my problem: In my django models.py I have something like: class MyModel(Model): test_field = SlugField(blank=True, null=False) # some other not-null not-blank fields here def save(self, *args, **kwargs): …
Alfonso_MA
  • 537
  • 5
  • 26
0
votes
0 answers

pdf report creation using pdfkit python django

I am creating pdf report using pdfkit 0.6.1 and from_url method in django 4 python but the problem on my local system pdf is creating as I required but when i am pushing code on production server it is creating pdf like this: pdf content is not…
0
votes
1 answer

How to access the names of fields in Django UniqueConstraint : 2?

I have original question here How to access the names of fields in Django UniqueConstraint? but it do not answer my question when *expressions contains different kind of "fields". I left the accepted answer. I want to access the unique constraint…
cedrik
  • 541
  • 7
  • 17
0
votes
0 answers

Cronjob with crontab fails to get access to my sqlite3 database in Django4

I want to use cronjobs to write data in my database. I use crontab do manage that. I hav setup the setting.py file like this: CRONJOBS = [ ('*/2 * * * *', 'someapp.cron.my_cron_test', ) ] the actual cron.py is in the app folder and looks like…
0
votes
1 answer

Django 4: How to modify MultiPolygonField from nullable to not-null

I am trying to convert my MultiPolygonField field from this: multipolygon = MultiPolygonField(null=True) to this: multipolygon = MultiPolygonField(null=False) It looks simple, so I execute "makemigrations" and I get the usual message warning that…
Alfonso_MA
  • 537
  • 5
  • 26
0
votes
0 answers

I want to run 'python3 manage.py collectstatic' with cron

I have a daily batch run in django with cron. # crontab -e All but the bottom of these batches seem to work correctly. 0 0 * * * root /root/certbot.sh 0 18 * * * root /var/www/html/venv/bin/python /var/www/html/portfolio/mysite/manage.py…
yoshitaka okada
  • 113
  • 1
  • 12
0
votes
0 answers

Filter_horizontal widget

How to apply Filter_horizontal widget in UpdateView, CreateView? Not in the administrative model. Django 4 filter_horizontal widget in CreateView, UpdateView