#36693: The "default" argument for ArrayAgg is being ignored
-------------------------------------+-------------------------------------
     Reporter:  Bryant Glisson       |                     Type:  Bug
       Status:  new                  |                Component:  Database
                                     |  layer (models, ORM)
      Version:  5.2                  |                 Severity:  Normal
     Keywords:  annotation, array    |             Triage Stage:
  aggregation                        |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
 I am overriding the `get_queryset` method of the admin and returning the
 following:

 {{{
 return
 super().get_queryset(request).annotate(sites_list=ArrayAgg('sites__name',
 default=Value([]), distinct=True))
 }}}

 The idea is to return a list of what sites a given record is associated
 with. When there are no sites, I'd like it to return an empty list. The
 docs suggest that the above should accomplish this, but it's returning
 `[None]` instead. I tried replacing `Value([])` with `[]`, but results are
 unchanged. If I replace it with `"TEST"`, I get an error "malformed array
 literal: 'TEST'", so it is attempting to interact with the argument, but
 both of the attempts at providing a list here are ignored. Any idea what
 may be causing this?
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36693>
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/0107019a2c07f1af-a0758f4d-5673-4439-836e-ec220063e3f7-000000%40eu-central-1.amazonses.com.

Reply via email to