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
0
votes
2 answers

Django How to do a correlated EXISTS or NOT EXISTS

How can I perform the following correlated EXISTS and NOT EXISTS in Django? I do not want to use IN and NOT IN. These are not the same as EXISTS and NOT EXISTS. Correlated EXISTS: SELECT * FROM foo WHERE EXISTS ( SELECT 1 FROM bar WHERE…
Matthew Moisen
  • 16,701
  • 27
  • 128
  • 231
0
votes
1 answer

Django How to use Postgresql's INSERT INTO ... WHERE conditional insert functionality?

Postgresql has a nice syntax for conditionally inserting: INSERT INTO child (name, parent_id) SELECT :name, :parent_id WHERE EXISTS ( SELECT 1 FROM parent WHERE id = :parent_id AND parent.user_id = :user_id ) In the above…
Matthew Moisen
  • 16,701
  • 27
  • 128
  • 231
0
votes
0 answers

Django Pass Extra Information To ManyToMany Model Signal

i have a manytomany django related models which needs an entry created automatically when one model is created using signals. my challenge is passing extra information to the signal for the intermediate Team model table? class…
0
votes
1 answer

How to access auth_user_group table by ID

How can I directly specify the ID column of auth_user_group table in queries/DML? I am referring to auth_user_group.id, not auth_group.id nor auth_user_group.group_id. For example, I want to directly issue DML like: delete from auth_user_group where…
Matthew Moisen
  • 16,701
  • 27
  • 128
  • 231
0
votes
0 answers

RedisCache' object has no attribute 'ttl'

hello friends in new project i use Django4 and i set the "django.core.cache.backends.redis.RedisCache" for the cache but i have the error it say "AttributeError: 'RedisCache' object has no attribute 'ttl'" .it refer to the line of my code that i add…
fahime
  • 5
  • 4
0
votes
2 answers

Custom django validation function

i have written validaiton function for an attribute is it correct and how should i write for same attribute with blank = True and add_1 is required field any conditions to add add_1 = models.CharField(max_length=255) add_2 =…
0
votes
1 answer

Where do you create the ini file? (Uwsgi)

my reference: https://docs.djangoproject.com/en/4.0/howto/deployment/wsgi/uwsgi/ my project name: 'mysite' my directories: I create 'uwsgi.ini'. then, I written in ini…
yoshitaka okada
  • 113
  • 1
  • 12
0
votes
1 answer

How to send Crypto payments (programmatically) gotten through coinbase commerce

i have successfully integrated coinbase commerce into my django app for receiving cryptocurrency payment from the users. However the site payment process involves receiving payment from a User A which is intended for User B into the site coinbase…
Brian Obot
  • 336
  • 4
  • 16
0
votes
2 answers

Display an inherited Field in Django 4.0 with ModelAdmin

I lookup for the solution but I believe I'm doing something wrong or in Django 4 is different. The created_at and updated_at fields doesn't appear on admin. I don't know what I'm skipping. The Parent class class TimeStampMixin(models.Model): class…
user16526709
0
votes
0 answers

AbstractUser object has no attribute 'model'

Below is my model.py class CustomUser(AbstractUser): email = models.EmailField(unique=True, primary_key=True) I override the default user model by providing a value for the AUTH_USER_MODEL setting.py AUTH_USER_MODEL = 'home.CustomUser' But…
helloworld
  • 149
  • 7
0
votes
1 answer

Django update from 3.2 -> 4.0 and DRF Paths

I wanted to try and upgrade my django app that runs just fine on django 3.2.6 to the next release, but even in testing I came across the deprecated url (https://docs.djangoproject.com/en/4.0/ref/urls/). So I replaced the last lines in the…
xtlc
  • 1,070
  • 1
  • 15
  • 41
-1
votes
1 answer

How can I check if two objects from differente models equal each other in Django?

I have 2 models, one for Students and another for Faculty. I need to print all Students from one specific Faculty. Model for Faculty class Fakultet (models.Model): fakultet_naziv=models.CharField(max_length=30) …
-2
votes
1 answer

More elegant one-liner way for urls.py to recognize path that include / as well as no / in Django

I am using Django v4. This is my urls.py from django.urls import path from .views import UserList, UserDetail urlpatterns = [ path("users", UserList.as_view()), ] http://127.0.0.1:8000/users works fine. However, http://127.0.0.1:8000/users/…
user3848207
  • 3,737
  • 17
  • 59
  • 104
1 2 3 4 5
6