Coverage for apis_core/apis_entities/utils.py: 71%

7 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-11-22 07:51 +0000

1from django.apps import apps 

2from django.contrib.contenttypes.models import ContentType 

3 

4from apis_core.apis_entities.models import AbstractEntity 

5 

6 

7def get_entity_classes(): 

8 return list(filter(lambda x: issubclass(x, AbstractEntity), apps.get_models())) 

9 

10 

11def get_entity_content_types(): 

12 return [ContentType.objects.get_for_model(model) for model in get_entity_classes()]