Common functionalities

This commit is contained in:
reverend 2020-11-29 19:22:38 +01:00
parent d9df6e67a8
commit 90dd281f7c

View 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