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
0
votes
1 answer

DJango Composite priamary key with instance field values

hi im having troubles in django 3.2 with a work arround for composite key's. as my customer request he needs a composite key as primary key not just on unique_together constraint so im wonder if there any way or place to intercept the instance be…
0
votes
0 answers

Get list of fileds from reverse relationship

I am trying to get the list of count of a field based on date so I can plot stacked bar graph on frontend. These are my models: class BaseModel(models.Model): id: int created_at = models.DateTimeField(verbose_name="Created",…
Nalin Dobhal
  • 2,292
  • 2
  • 10
  • 20
0
votes
1 answer

Django making migrations

Consider the following three classes: class UUIDModel(models.Model): id = models.UUIDField(primary_key=True, editable=False, default=uuid.uuid4) class Meta: abstract = True class TimeStampedUUIDModel(UUIDModel): created =…
Infinite Possibilities
  • 7,415
  • 13
  • 55
  • 118
0
votes
1 answer

Django Channels Consumer Not Connecting to websocket

i created a websocket with javascripts on the client side...then followed up with setting up my project to handle webocket connections as follows(following the official django-channels documentation). But each time i refresh the page and watch the…
Brian Obot
  • 336
  • 4
  • 16
0
votes
1 answer

Why reloading is submitting the form in django?

I have a view function for login which blocks user after 3 unsuccessful login attempts the function is as follows def my_login(request): context = {} if request.method == 'POST': form = LoginForm(request.POST) user_id =…
Premkumar
  • 23
  • 5
0
votes
1 answer

In Django 3.2, how do I intialize my ManyToMany field in my consturctor with values from an array?

I'm using Python 3.9 and Django 3.2. I have this model with a ManyToMany field ... class Account(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) active = models.BooleanField(default=True) …
Dave
  • 15,639
  • 133
  • 442
  • 830
0
votes
1 answer

What are the options to get filter on union querysets behavior with Django?

Basically the problem I have: I need an option or alternative approach to filter on annotated fields on union queryset. I have the following simplified models setup: class Course(Model): groups = ManyToManyField(through=CourseAssignment) class…
0
votes
1 answer

Django - delete M2M field but keep join table

is it possible to remove an M2M field from a model and keep the joining table? context: I am trying to add through model to existing M2M field like described in this post But doing it simply like this will result in a production app crash when…
Charlestone
  • 1,248
  • 1
  • 13
  • 27
0
votes
1 answer

Django 3.2.8 custom middleware returns 302 redirect errors

I am looking to use custom middleware to redirect a user to a their profile role if their profile role value is set to '0'. Below is the current code I am using, but is causes a 302 redirect loop. This is based on other examples I found on the…
Franna
  • 3
  • 2
0
votes
1 answer

How do I configure my Django REST framework view to recognize my "Authorization" header?

I'm using Django 3.2 with djangorestframework==3.12.2. DRF doesn't seem to be recognizing/parsing the authorization header I'm sending with my requests. I have this set up in my settings file REST_FRAMEWORK = { 'DEFAULT_PERMISSION_CLASSES': [ …
0
votes
1 answer

how to sort a queryset using django and htmx?

i'm using django-filter to apply filters, and on the new queryset i want to make an htmx request sort that depend on select tag change the new queryset sorting, here is my view: views.py def sorted_htmx_products(request): context = {} qs=…
miyou995
  • 77
  • 10
0
votes
2 answers

Django: STATIC_ROOT STATIC_ROOT can't join with BASE_DIR path

I want my STATIC_ROOT path to be at F:/7.Django/BLOG_PROJECT/src_blog/' + '/vol/web/staticfiles but django set it at F:/vol/web/staticfiles I set up my STATIC_ROOT like this STATIC_ROOT = os.path.join(BASE_DIR,'/vol/web/staticfiles') print('this is…
0
votes
1 answer

Django ModelForm with Access to More than One Model

So, i want to know if it possible to have a django modelform access more than 1 django model... i currently have 2 models relating to the product and they are shown below...the reason i made 2 models is to allow each product to have multiple…
0
votes
0 answers

How to display database content without parsing an ID to the urls in django

I'm still a beginner in Django and building a management system, I wish to display content from the database using a for loop from 2 tables(GoCustomerRegisration and GoCustomerStatus). But unfortunately, when I iterate over one table the other table…
0
votes
1 answer

Django large queryset return as response efficiently

I have a model in django called "Sample" I want to query and return a large number of rows ~ 100k based on filters. However, it's taking up to 4-5 seconds to return the response and I was wondering whether I could make it faster. (Need to improve…
Shubham Periwal
  • 2,198
  • 2
  • 8
  • 26
1 2 3
8 9