﻿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
5311	Validation of erroneous data model breaks with AttributeError instead of a useful message (like it used to)	raik.gruenberg@…	nobody	"I've updated the data model of my django project and run manage.py sql <app_name> to check the changes.
I obviously made an error but rather than reporting it, the current svn revision of django breaks with the following traceback:

{{{
brickitserver|~/py/djbrickit> python manage.py sql repository
Traceback (most recent call last):
  File ""manage.py"", line 11, in <module>
    execute_manager(settings)
  File ""/usr/lib/python2.5/site-packages/django/core/management/__init__.py"", line 180, in execute_manager
    utility.execute(argv)
  File ""/usr/lib/python2.5/site-packages/django/core/management/__init__.py"", line 124, in execute
    command.execute(*args[1:], **options.__dict__)
  File ""/usr/lib/python2.5/site-packages/django/core/management/base.py"", line 33, in execute
    self.validate()
  File ""/usr/lib/python2.5/site-packages/django/core/management/base.py"", line 60, in validate
    num_errors = get_validation_errors(s, app)
  File ""/usr/lib/python2.5/site-packages/django/core/management/validation.py"", line 72, in get_validation_errors
    rel_opts = f.rel.to._meta
AttributeError: 'str' object has no attribute '_meta'
}}}

By contrast, svn revision 5000 gives this nice informative error message for the same command:

{{{
brickitserver|~/py/brickit/djbrickit> python manage.py sql repository
Error: One or more models did not validate:
djbrickit.repository: name 'BRICK_Format_CHOICES' is not defined
}}}

The offending part of my model looks like this:

{{{
class Biobrick:
   BRICK_FORMAT_CHOICES = ( ('classic', 'classic biobrick format'),... )
   ...
   brick_format = models.CharField( 'format of Biobrick', maxlength=30,
                                   choices=BRICK_Format_CHOICES,
                                   default='classic' )
   ...
}}}
"		closed	Core (Management commands)	dev		duplicate	model validation sprintsept14		Accepted	0	0	0	0	0	0
