mirror of
https://github.com/django/django.git
synced 2025-10-05 00:00:37 +00:00
Made Options.get_base_chain() always return a list.
This commit is contained in:
parent
825429c1f7
commit
6bd7ee4eab
2 changed files with 6 additions and 6 deletions
|
@ -651,12 +651,12 @@ class Options(object):
|
|||
|
||||
def get_base_chain(self, model):
|
||||
"""
|
||||
Returns a list of parent classes leading to 'model' (order from closet
|
||||
to most distant ancestor). This has to handle the case were 'model' is
|
||||
a grandparent or even more distant relation.
|
||||
Return a list of parent classes leading to `model` (ordered from
|
||||
closest to most distant ancestor). This has to handle the case where
|
||||
`model` is a grandparent or even more distant relation.
|
||||
"""
|
||||
if not self.parents:
|
||||
return None
|
||||
return []
|
||||
if model in self.parents:
|
||||
return [model]
|
||||
for parent in self.parents:
|
||||
|
@ -664,7 +664,7 @@ class Options(object):
|
|||
if res:
|
||||
res.insert(0, parent)
|
||||
return res
|
||||
return None
|
||||
return []
|
||||
|
||||
def get_parent_list(self):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue