1

I am using Django 1.6 and i need to group some results from a queryset like this:

model
   .all()
   .values('enum1', 'enum2')
   .annotate(
      value__min=Min('value'), 
      value__max=Max('value')
   )

now on iteration i need to get the value of get_enum1_display() but values() returns a dict object, so that the method does not exist anymore. Is there a workaround?

Iwan1993
  • 1,669
  • 2
  • 17
  • 25
  • 1
    possible duplicate of [Django - aggregation with get\_FOO\_display](http://stackoverflow.com/questions/25060594/django-aggregation-with-get-foo-display). And the answer would be like `model(enum1=values['eunm1']).get_enum1_display()` – okm Dec 25 '14 at 15:49

0 Answers0