diff --git a/django_lostplaces/lostplaces/common.py b/django_lostplaces/lostplaces/common.py new file mode 100644 index 0000000..1b438f9 --- /dev/null +++ b/django_lostplaces/lostplaces/common.py @@ -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 \ No newline at end of file