Changes between Initial Version and Version 1 of Ticket #29072, comment 3
- Timestamp:
- Sep 5, 2019, 3:09:46 PM (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #29072, comment 3
initial v1 1 1 I was looking for how to more elegant reduce joined query what author talk, and not found good solution, list all unneeded fields of joined table in 'defer' is not elegant solution. At this moment django doesn't has it. If look on how can customize prefetch_related with Prefetch() I have suggestion create e.g. 'Select' for select_related and use it like that: select_related('g') or select_related(Select('g').only('r', 't', 's', 'u')) 2 3 My current solution: 4 `select_related('g').defer(*{f'g__{x.name}' for x in g._meta.fields if x.name not in {'r', 't', 's', 'u'}})`