#24387: Django admin, exception in queryset when using values() before annotate
-------------------------+-------------------------------------------------
Reporter: essadek | Owner: nobody
Type: Bug | Status: new
Component: | Version: 1.6
contrib.admin | Keywords: Django Admin , aggregation, change
Severity: Normal | list
Triage Stage: | Has patch: 0
Unreviewed |
Easy pickings: 0 | UI/UX: 0
-------------------------+-------------------------------------------------
{{{
class AppModel(models.Model):
nbr = models.BigIntegerField(blank=True, null=True)
region = models.ForeignKey(AppWilaya,blank=True, null=True)
date_preorder = models.DateField(blank=True, null=True)
id = models.IntegerField(primary_key=True,blank=True,
db_column='dummy_id')
}}}
{{{
class AppModelAdmin(admin.ModelAdmin):
....
def queryset(self, request):
qs = super(AppModelAdmin, self).get_queryset(request)
qs=qs.values("region").annotate(total=Sum( 'nbr'))
}}}
'''Exception Value: 'dict' object has no attribute '_meta'
Exception Location: [PATH_TO]\lib\site-
packages\django\contrib\admin\util.py in lookup_field, line 242'''
Note when removing '''.values("region")''' the exception doesn't occur.
--
Ticket URL: <https://code.djangoproject.com/ticket/24387>
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/050.031ded77d0bf541352cbb0526bec723c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.