#27149: Filtering with generic relation
-------------------------------------+-------------------------------------
     Reporter:  MikiSoft             |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  QuerySet.extra       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by shaib):

 Hi,

 Thanks for the suggestion; the code, as given, is not fit for general use
 because it makes assumptions which are not guaranteed to hold:
  - it assumes the `model` and `target` belong to the same app
  - it assumes the modles use the default table names (i.e. none of the
 models specifies  `Meta.db_table`)
  - it assumes the default app label  (a different one can be set via
 `AppConfig` objects)
  - it assumes the names `content_type_id` and `object_id` for the
 components of the generic FK -- these are not even defaults, but only a
 convention

 Further, the code uses `target` in a way which bakes some of these
 assumptions into the API, not just the implementation.

 I suggest you bring the idea up on the DevelopersMailingList, to get a
 wider discussion of whether the feature fits for inclusion in Django, and
 if so, to define an API everyone agrees on. When you do, please make sure
 you present the problem before you suggest your solution.

--
Ticket URL: <https://code.djangoproject.com/ticket/27149#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.dcd9c5bb5bb76563e6b903f18074bcad%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to