Questions tagged [django-prefetch-related]
17 questions
0
votes
1 answer
django reverse foreign key pefetch related, queryset condition not working
Consider the following condition:
class Book(models.Model):
name = models.CharField(max_length=300)
price = models.IntegerField(default=0)
def __str__(self):
return self.name
class Store(models.Model):
name =…

Nishant Kashyap
- 819
- 2
- 15
- 25
0
votes
1 answer
How to reduce more `SELECT` queries which are already reduced by "prefetch_related()" to iterate 3 or more models?
I have Country, State and City models which are chained by foreign keys as shown below:
class Country(models.Model):
name = models.CharField(max_length=20)
class State(models.Model):
country = models.ForeignKey(Country,…

Super Kai - Kazuya Ito
- 22,221
- 10
- 124
- 129