Questions tagged [django-4.1]

Django 4.1 is the latest version of the Django framework, released in August 2022. Please only use this tag if your question relates specifically to this version.

Django 4.1 works with Python 3.8, 3.9, 3.10, and 3.11.

Here are some of the salient features of Django 4.1:

Django 4.1 was released in August 2022 and is supported until December 2023.

41 questions
0
votes
0 answers

Not able to send signed request to authentik from django project using djangosaml2

[DJangoSAML2][1] Here is the SAML configuration in settings.py file SAML_CONFIG = { 'xmlsec_binary': '/usr/bin/xmlsec1', 'name': 'authentik', 'entityid': 'authentik', 'service': { 'sp': { …
SEJ
  • 296
  • 1
  • 16
0
votes
0 answers

Django admin searchfield with GenericForeignKey

My Django Foo model has the following GenericForeignKey: content_type = models.ForeignKey(ContentType, blank=True, null=True, on_delete=models.SET_NULL) object_id = models.PositiveIntegerField(blank=True, null=True) my_object =…
0
votes
1 answer

Testing a Consumer is failing when use database_sync_to_async Djagno Channels

So, I didn't use channels for a very long time, so let's be that this is a first time that I have tried to do something. I am trying to create 1 Consumer, wrapped with 1 custom Auth middleware and I want to test my Consumer, if it behaves properly…
milutinke
  • 401
  • 1
  • 4
  • 13
0
votes
2 answers

Django: Combine multiple forms into single one

I'm working with a django(4) project, Where I have two forms and want to combine them into one to display in my template with custom html not by sing {{form}} syntax. Here's my forms.py: class UserUpdateForm(forms.ModelForm): email =…
Abdul Rehman
  • 5,326
  • 9
  • 77
  • 150
0
votes
1 answer

How use ProcessPoolExecutor in django?

In a Django Project I want to use ProcessPoolExecutor but I can do that. Is there any solution? I call a function in view that has executor. I use Django==4.1.7. what should add to my function to run in django. The start() function works properly…
0
votes
0 answers

Django 4.1, social auth with GIT, error: http://127.0.0.1:8000/complete/github/?error=redirect_uri_mismatch&error_description=The+redirect_uri+MUST

I have been asking everywhere I could, I saw some answers here that mentioned adding a host entry for 127.0.0.1 but since my dev serve is on an Ubuntu VM locally I am not sure how that would work. Anyways, I actually copied the URI from GitHub and…
Steve
  • 1,028
  • 7
  • 25
  • 42
0
votes
0 answers

Trying to create a one-time calculated field in Django model

Building my first Django app, and I'm running into a snag. I have a Django model that creates Job objects, and I want each job code to be unique and auto-generated, with a particular format. The format is: aaaMMnnYYYY, where aaa is a 3-letter client…
Joe Connor
  • 62
  • 1
  • 6
0
votes
1 answer

How to combine multiple custom management commands in Django?

I wrote a set of commands for my Django project in the usual way. Is it possible to combine multiple commands into one command? class Command(BaseCommand): """ import all files in media in dir and add to db after call process to generate…
JasonTS
  • 2,479
  • 4
  • 32
  • 48
0
votes
0 answers

Django Server stuck after updating from python 3.9 to python 3.10 (using Django 4.1.5)

After upgrading python 3.9 to 3.10 the Django Server isn't working locally anymore (I'm using the Django Server Plugin for Pycharm). In my gitlab pipeline it seems to work allright. Below you can see further details (click link to see…
0
votes
0 answers

Adding a new middleware in my django ( 4.1.4) project

The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Users\HP\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 1038, in _bootstrap_inner self.run() File…
0
votes
3 answers

Django: Filter matching objects using 2 fields

I have the following classes: class Event(Model): ... class IOCType(Model): name = CharField(max_length=50) class IOCInfo(Model): event = ForeignKey(Event, on_delete=CASCADE, related_name="iocs" ioc_type = ForeignKey(IOCType,…
wisvem
  • 5
  • 1
  • 3
0
votes
0 answers

Code Coverage with Django 4.1 Raising OSError on run

i am using python 3.10.8, django 4.1.4, and coverage 6.5.0. I tried adding the coverage library to my django project to measure the test coverage, I followed the setup process as shown on the Official Django Documentation on testing. Whenever I run…
Brian Obot
  • 336
  • 4
  • 16
0
votes
1 answer

How to retrieve attributes from a foreign key related model to another foreign key related model?

I'm using django 4.1.2 with python 3.10.8. I have three models one for user management, one for questions and another for answers. They are described below: class User(AbstractUser): phone_number = models.CharField(max_length=14, unique=True) …
NegassaB
  • 379
  • 7
  • 24
0
votes
1 answer

Multi-table inheritance and two many to many via through model not working in admin inline

I'm trying to create navigation menu from the django admin as per user's requirement. The Model look like this: class MenuItem(models.Model): title = models.CharField(max_length=200, help_text='Title of the item') created_at =…
DrGeneral
  • 1,844
  • 1
  • 16
  • 22
0
votes
0 answers

Django 4.1.3 : ImportError: cannot import name 'ugettext_lazy' from 'django.utils.translation'

I'm running a Django 4.1.3 based REST api on GCP. The package Django Generic Relation is throwing an error : ImportError: cannot import name 'ugettext_lazy' from 'django.utils.translation'…