﻿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
3323	Unhelpful error message in case of unresolved string relation ('str' object has no attribute '_meta')	alex@…	nobody	"imagine the following model:

{{{
class Test(models.model):
   rel = models.ForeignKey(""bleh"")
}}}

if the relation is not resolvable, in case of a typo or if it's in a different file, the user gets a rather unhelpful exception:

{{{
Unhandled exception in thread started by <function inner_run at 0x2af9aa4e9668>
Traceback (most recent call last):
  File ""/home/alex/source/svn/django/django/core/management.py"", line 1108, in inner_run
    validate()
  File ""/home/alex/source/svn/django/django/core/management.py"", line 1070, in validate
    num_errors = get_validation_errors(outfile)
  File ""/home/alex/source/svn/django/django/core/management.py"", line 936, in get_validation_errors
    for r in rel_opts.get_all_related_objects():
  File ""/home/alex/source/svn/django/django/db/models/options.py"", line 127, in get_all_related_objects
    if f.rel and self == f.rel.to._meta:
AttributeError: 'str' object has no attribute '_meta'
}}}

a quick hacky fix is attached, but i guess it should be done in django.core.management.validate
"		closed	Database layer (models, ORM)	dev		fixed	sprintsept14 sprintdec01		Ready for checkin	1	0	0	0	0	0
