﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
17497	Confusing exception message when using values_list with relations	Jonas Obrist	antoviaque	"Assuming following models:


{{{
from django.db import models


class Reporter(models.Model):
    first_name = models.CharField(max_length=30)
    last_name = models.CharField(max_length=30)
    email = models.EmailField()

    def __unicode__(self):
        return u""%s %s"" % (self.first_name, self.last_name)

class Article(models.Model):
    headline = models.CharField(max_length=100)
    pub_date = models.DateField()
    reporter = models.ForeignKey(Reporter)

    def __unicode__(self):
        return self.headline

    class Meta:
        ordering = ('headline',)
}}}

Running this query:


{{{
Article.objects.values_list('reporter__notafield')
}}}

Will report this error message:

{{{
""Cannot resolve keyword 'reporter__notafield' into field. Choices are: headline, id, pub_date, reporter""
}}}

This might look as if values_list only allows fields on a model and not relations. I propose the error message to change to something like ""Cannot resolve keyword 'notafield' into field. Choices are 'article', 'email', 'first_name', 'id', 'last_name'"".

I've attached a simple patch with a test case."	Cleanup/optimization	closed	Database layer (models, ORM)	1.3	Normal	fixed		ojiidotch@… antoviaque	Ready for checkin	1	0	0	0	0	0
