#3323: Unhelpful error message in case of unresolved string relation
---------------------------+------------------------------------------------
Reporter: [EMAIL PROTECTED] | Owner: adrian
Status: new | Component: Database wrapper
Version: SVN | Keywords:
Stage: Unreviewed | Has_patch: 0
---------------------------+------------------------------------------------
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
--
Ticket URL: <http://code.djangoproject.com/ticket/3323>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django
updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---