Skip to main content
3 votes
1 answer
51 views

I've got these models: class Component(models.Model) name = models.CharField(max_length=50) class ComponentAttribute(models.Model) component = models.ForeignKey(Component) context = ...
Tschick Müller's user avatar
2 votes
1 answer
58 views

Let's take some Store and Book models as examples: class Book(Model): title = CharField(...) ... class Store(Model): books = ManyToManyField('Book', blank=True, related_name='stores') ...
Valkoinen's user avatar
0 votes
1 answer
77 views

Describe the Problem I have a ModelViewSet in Django REST Framework designed to return a list of Order objects. To improve performance, I'm trying to implement custom pagination that limits the ...
Raul Chiarella's user avatar
1 vote
1 answer
46 views

I'm refactoring a legacy Django Job to use annotate with filtered Count aggregations instead of querying each record individually (avoiding the N+1 problem). I want to count the number of related ...
Raul Chiarella's user avatar
2 votes
1 answer
95 views

If I have, for example: from django.contrib.postgres.fields import JSONField class MyModel(models.Model): data = JSONField() GIVEN a model instance obj1, where data == ['apple', 'banana', '...
Dane Iracleous's user avatar
1 vote
1 answer
53 views

I am trying to get the book list with 3 conditions: Accession number (character varying,10) Physical location (character varying,20) Book status Based on the user input: Accession number should be ...
PM.'s user avatar
  • 1,731
0 votes
1 answer
66 views

I try to check - in Django - if a user-made queryset has two fields which match 100%. class Foo(models.Model): # ... free_field = models.ForeignKey(FreeModel, ...) must_match_m2m_field = ...
baloersch's user avatar
0 votes
1 answer
88 views

I'm currently developing a Gym website and using django-recurrence to handle recurring training sessions. However, I'm unsure how to work with recurrence dates in a Django QuerySet. Specifically, I ...
Dmytro Hryshchenko's user avatar
1 vote
1 answer
88 views

I have class Book(models.Model): title = models.CharField(max_length=32) class Table(models.Model): book = models.ForeignKey(Book, related_name='tables') class TableEntry(models.Model): ...
Daniel Krenn's user avatar
0 votes
0 answers
55 views

I've got an annotation for a foreign key field that I use frequently and would like to write a custom Django Transform which behaves similar to the annotation. The annotation that does what I would ...
bnett's user avatar
  • 1
0 votes
1 answer
52 views

In my Django project, I'm in need of a generic istruthy/isfalsy lookup that would work on any type of database field. Example of models.py: class MyModel(models.Model): my_charfield = models....
Luci's user avatar
  • 477
-1 votes
1 answer
73 views

I have model Report and GroupReport. They have many-to-many relation. I can easily get QuerySet[GroupReport] for all GroupReport instance: Group Name 1: Report Name 1 Report Name 2 Group ...
Qngdjas's user avatar
1 vote
0 answers
52 views

I have the following model: class Historique(models.Model): type_of_object_choices = ( (1, 'Cadeau') , (2, 'Offre') , (3, 'Commentaire') ) event_type_choices = ...
gibbe75's user avatar
  • 33
1 vote
0 answers
52 views

I'm debugging sitemap generation, and finally have the following snippet: items=Event.objects.all() for limit in (1000, 10000, 20000): events=items[:limit] ...
aikipooh's user avatar
  • 293
4 votes
1 answer
283 views

I have the following Django models: from django.db import models from django.utils.translation import gettext_lazy as _ class Enterprise(models.Model): nome = models.CharField(max_length=255) ...
Ives Furtado's user avatar

15 30 50 per page
1
2 3 4 5
458