django-extensions/django-extensions — pull request #463 by cherepski (2014-01-30 02:38:06+00:00)
Title: Abstract models that don't have explicit relationships defined are failing. This commit at least gives the user a useful exception to figure out the issue.

I ran into an issue where I had an abstract class that contained an implicit lazy relationship (string) which was raising the exception,
Traceback (most recent call last):
File "manage.py", line 14, in
execute_manager(settings)
File "/srv/www/mei1151_eventdb/virtpy/lib/python2.6/site-packages/django/core/management/__init__.py", line 459, in execute_manager
utility.execute()
File "/srv/www/mei1151_eventdb/virtpy/lib/python2.6/site-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/srv/www/mei1151_eventdb/virtpy/lib/python2.6/site-packages/django/core/management/base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File "/srv/www/mei1151_eventdb/virtpy/lib/python2.6/site-packages/django/core/management/base.py", line 232, in execute
output = self.handle(*args, **options)
File "/srv/www/mei1151_eventdb/virtpy/lib/python2.6/site-packages/django_extensions/management/commands/graph_models.py", line 73, in handle
dotdata = generate_dot(args, cli_options=cli_options, **options)
File "/srv/www/mei1151_eventdb/virtpy/lib/python2.6/site-packages/django_extensions/management/modelviz.py", line 232, in generate_dot
add_relation(field, '[arrowhead=none, arrowtail=dot, dir=both]')
File "/srv/www/mei1151_eventdb/virtpy/lib/python2.6/site-packages/django_extensions/management/modelviz.py", line 211, in add_relation
'target_app': target_model.__module__.replace('.', '_'),
AttributeError: 'str' object has no attribute '__module__'

field.rel.to contains the string lazy relationship from the abstract model foriegnkey field which causes the above exception to be raised.