Skip to content

Commit

Permalink
Merge pull request #446 from ezawadzki/issue-445
Browse files Browse the repository at this point in the history
Check if 'descendants' list has values
  • Loading branch information
deschler committed Jan 26, 2018
2 parents 817fc04 + 5f2576e commit 8ec460b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions modeltranslation/translator.py
Expand Up @@ -466,9 +466,10 @@ def register(self, model_or_iterable, opts_class=None, **options):
else:
descendants = [d.__name__ for d in self._registry.keys()
if issubclass(d, model) and d != model]
raise DescendantRegistered(
'Model "%s" cannot be registered after its subclass'
' "%s"' % (model.__name__, descendants[0]))
if descendants:
raise DescendantRegistered(
'Model "%s" cannot be registered after its subclass'
' "%s"' % (model.__name__, descendants[0]))

# Find inherited fields and create options instance for the model.
opts = self._get_options_for_model(model, opts_class, **options)
Expand Down

0 comments on commit 8ec460b

Please sign in to comment.