#36218: allow annotate to override model's fields
-------------------------------------+-------------------------------------
     Reporter:  Jan Napieralski      |                     Type:  New
                                     |  feature
       Status:  new                  |                Component:  Database
                                     |  layer (models, ORM)
      Version:  5.1                  |                 Severity:  Normal
     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
-------------------------------------+-------------------------------------
 I want to modify the QuerySet field such that it is fetched from DB and
 its real field is redacted. For example fetching some employee data, but
 replacing all the emails and phone numbers to NULL's because of some
 security or role flag in the API resolver for this

 Currently the .annotate() method doesn't allow for the overlap of output
 field with model field. I have seen, that the way to handle it is to call
 .values() excluding the overwritten field, but in the large models with
 many fields or queries with joins, its not realistically possible to know
 what fields will be used when doing this QuerySet manipulation. The
 .deffer() doesn't work neither

 I propose some flag to the .annotate() for allowing to overlap and
 essentially overwrite the model field, bc currently the only way without
 evaluating it, is the .extra()
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36218>
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 view this discussion visit 
https://groups.google.com/d/msgid/django-updates/010701954c5dde6e-442e0968-2f85-4c78-9220-b06b0c4d80a2-000000%40eu-central-1.amazonses.com.

Reply via email to