Description

I'm working on a medium-sized data model, and am fixing initial typos like missing quotes or caps. The errors manage.py give me are surprisingly vague, since they don't tell me either line number or object:

manage.py validate

Site.Q: name 'name' is not defined
1 error found.

(The identifier 'name' is all over the model, where did I use it wrong?)

manage.py validate

Site.Q: name 'question' is not defined
1 error found.

(same as above... I'd like to know which object model is using
'question' wrong, or a line number...)

name 'name' is not defined is not a Django-specific error; it's a Python syntax error. You're trying to use a variable that you haven't defined yet.

For the record, that Python error is collected in django.db.models.loading.get_apps() and used in django.core.management.get_validation_errors(). There doesn't seem to be a way to get the line number of an exception like that without bringing in some other machinery (such as the traceback module), which I see as too heavyweight for use here. Hence, I'm marking this as a wontfix.