Questions tagged [django-3.2]

Django 3.2 is the current LTS version of the Django framework, released April 2021. It is a Long Term Support (LTS) release, and will be supported until April 2024. Please only use this tag if your question relates specifically to this version.

Django 3.2 works with Python 3.6, 3.7, 3.8, 3.9, and 3.10.

Here are some of the salient features of Django 3.2:

Django 3.2 was released in April 2021 and is supported until April 2024.

128 questions
2
votes
3 answers

if field.many_to_many and field.remote_field.through._meta.auto_created: AttributeError: 'str' object has no attribute '_meta'

A source Django 3 by examples Chapter 14 When I try to run python manage.py migrate --settings=educa.settings.pro Another files are copies and pastes from the book The result is File "C:\Python\educa\manage.py", line 22, in main() …
2
votes
2 answers

Django JSONField complex query ... practical example of querying complex nested data structure

I have inherited the following JSONField data structure: [ { "name": "Firstname", "show": { "value": true }, "type": "text", "uuid": "55668e45-07d1-404e-bf65-f6a3cacfaa97", "label": { "for": "Firstname", …
Micheal J. Roberts
  • 3,735
  • 4
  • 37
  • 76
2
votes
1 answer

Why am I getting a 'ProgrammingError: relation "auth_user" does not exist' exception when running tests?

Recently I've migrated a Django project from version 1.9.1 to 3.2.7. Now I'm trying to write some new tests, and I'm getting this error: # python manage.py test Creating test database for alias 'default'... Got an error creating the test database:…
nKn
  • 13,691
  • 9
  • 45
  • 62
2
votes
1 answer

Table not found in migration file

Error Message django.db.utils.OperationalError: no such table: clientauth_tbltokentypes What I am trying to do I am trying to migrate data with table generation. models.py class tbltokentypes(models.Model): token_type_id:…
Pankaj
  • 9,749
  • 32
  • 139
  • 283
2
votes
1 answer

"django.core.exceptions.ValidationError: ['“post_id” is not a valid UUID.']" with seemingly valid UUID

This is a simple blog app I am creating. I have a model that creates an article and generates a UUID for each article created. This functions as expected. I am now attempting to create a view variable that contains the "post_id" object from my model…
2
votes
1 answer

Dictionary comprehension with Q

Let's say I have the following piece of code: criteria = {'description': 'tt', 'hostname': '2'} filters = Q() {filters.add(Q(**{k+'__icontains': v}), Q.AND) for k,v in criteria.items()} I can't figure out how to avoid doubling the outcome: {
ZmuA
  • 151
  • 1
  • 13
2
votes
1 answer

django rest api __init__() takes 1 positional argument but 2 were given

api link is not working. show this error "init() takes 1 positional argument but 2 were given" Please help me. I am beginner in django trying to creat blog api model.py: class Blog(models.Model): blog_id = models.AutoField(primary_key=True,…
techedifice
  • 163
  • 1
  • 11
2
votes
0 answers

Django Send Email Error: ConnectionRefusedError: [Errno 61] Connection refused

I was trying to send an email via Django using the send_mail() function from django.core.mail when I ran into this error: ConnectionRefusedError: [Errno 61] Connection refused This is my code, straight from the docs: from django.core.mail import…
2
votes
0 answers

Django logger is logging logs with two different time , sometime in GMT and sometime in IST

Django logger is logging logs with two different time, sometime with GMT and sometime with IST. IST is the localtime. Setting has not been changed between these two logs. django logger from settings is printing these two logs in file: 2021-04-19…
Ankita
  • 63
  • 6
2
votes
2 answers

Resolve django test RuntimeError on channels/async testcases

I'm trying to write a testcase for my django (3.2) channels consumer to implement websocket communication. I've managed to get the testcase to pass, but now it seems that the testcase teardown fails when trying to cleanup the test database. System…
monkut
  • 42,176
  • 24
  • 124
  • 155
1
vote
1 answer

Django api returns Gif as JPG despite a function to add it as video

I'm trying to upload a .gif to my django 3.2 api. I have already ran troubleshoots through Postman and came to the conclusion that my flutter app sends it as a .gif and it gets returned as a .jpg. The problem is on the backend. Here is my relevant…
Earthling
  • 83
  • 3
  • 13
1
vote
1 answer

Calling QuerySet.only() after union() is not supported

I'm a newbie to django here. I'm getting the following error on my django backend: Calling QuerySet.only() after union() is not supported The error producing code is the following : post_notification_target_users =…
1
vote
1 answer

django.db.utils.NotSupportedError: extension "postgis" is not available

I'm running django 3.2 on Ubuntu 22.04 LTS with the following database engine in settings.py: 'ENGINE' :'django.contrib.gis.db.backends.postgis' My webserver runs through docker. This is my docker file : FROM python:3.8.14 RUN apt-get -y update…
Earthling
  • 83
  • 3
  • 13
1
vote
1 answer

OSError: /usr/lib/libgdal.so: cannot open shared object file: No such file or directory

I'm using Django 3.2 on Ubuntu 22.04 LTS. I'm running a docker container with a django-rest-api web server with python 3.8.14.I'm getting an error with regards to the GDAL library when i run docker-compose and fire up the container. OSError:…
Earthling
  • 83
  • 3
  • 13
1
vote
1 answer

Diango matching a string with a regex field

In django, if we have a regex and look for a rows whose a field is matching with a regex, it will be something like this: MyAudience.objects.filter(email__iregex=f'^({'|'.join(emails)})$') But what if I want to do it the other way? Let's say I have…
barej
  • 1,330
  • 3
  • 25
  • 56
1
2
3
8 9