Common functionalities
This commit is contained in:
parent
d9df6e67a8
commit
90dd281f7c
11
django_lostplaces/lostplaces/common.py
Normal file
11
django_lostplaces/lostplaces/common.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
def get_all_subclasses(cls):
|
||||||
|
'''
|
||||||
|
Gets all subclasses recursively, does not contain
|
||||||
|
abstract classes
|
||||||
|
'''
|
||||||
|
subclass_list = []
|
||||||
|
for subclass in cls.__subclasses__():
|
||||||
|
if not subclass._meta.abstract:
|
||||||
|
subclass_list.append(subclass)
|
||||||
|
subclass_list += get_all_subclasses(subclass)
|
||||||
|
return subclass_list
|
Loading…
Reference in New Issue
Block a user