Skip to content

Commit

Permalink
Fixed a bug, where only one level of abstract attributes were include…
Browse files Browse the repository at this point in the history
…d in children.
  • Loading branch information
joernhees authored and justinabrahms committed Nov 24, 2010
1 parent a2c7f99 commit fce4eb6
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions django_extensions/management/modelviz.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,17 @@ def generate_dot(app_labels, **kwargs):

for appmodel in get_models(app):
abstracts = [e.__name__ for e in appmodel.__bases__ if hasattr(e, '_meta') and e._meta.abstract]
abstract_fields = []
for e in appmodel.__bases__:
if hasattr(e, '_meta') and e._meta.abstract:
abstract_fields.extend(e._meta.fields)

# collect all attribs of abstract superclasses
def getBasesAbstractFields(c):
_abstract_fields = []
for e in c.__bases__:
if hasattr(e, '_meta') and e._meta.abstract:
_abstract_fields.extend(e._meta.fields)
_abstract_fields.extend(getBasesAbstractFields(e))
return _abstract_fields
abstract_fields = getBasesAbstractFields(appmodel)

model = {
'app_name': appmodel.__module__.replace(".", "_"),
'name': appmodel.__name__,
Expand Down

0 comments on commit fce4eb6

Please sign in to comment.