Confirmed. I opened a bug report: 
https://code.djangoproject.com/ticket/29032.

On Wednesday, January 17, 2018 at 11:37:23 AM UTC-5, Joseph Lucas wrote:
>
> Hi,
>
> We were not able to reproduce an example described in Django's 
> documentation, concerning the value() method of Queryset 
> <https://docs.djangoproject.com/en/1.11/ref/models/querysets/#values>.
>
> >>> from django.db.models import Count 
> >>> Blog.objects.values('author', entries=Count('entry')) 
> <QuerySet [{'author': 1, 'entries': 20}, {'author': 1, 'entries': 13}]> 
>
> When executing above lines with the fixtures described in the docs, we get 
> the following error: 
>
> django.core.exceptions.FieldError: Cannot resolve keyword 'author' into 
> field. Choices are: entries, entry, id, name, tagline
>
> This second example from the documentation doesn't seem to work either:
>  
> >>> Blog.objects.values('author').annotate(entries=Count('entry')) 
> <QuerySet [{'author': 1, 'entries': 33}]>
>
> Did we miss something ? 
> Is the django documentation accurate here ? We wonder how a Blog object 
> could have an 'author' field, given its model definition 
> <https://docs.djangoproject.com/en/1.11/topics/db/queries/#>.
>
> Please find attached a minimal project with unittests reproducing these 
> issues.
>
> Sincerely,
>
> Joseph Lucas
> Arnaud Peloquin
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" 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].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6cc4caaf-87e5-4809-b303-df65f2c93526%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to