Coverage for django_napse/core/models/accounts/managers/space.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v7.4.3, created at 2024-03-12 13:49 +0000

1from django.apps import apps 

2from django.db import models 

3 

4 

5class NapseSpaceManager(models.Manager): 

6 def create(self, name: str, exchange_account, description: str = ""): 

7 """Create a Space instance.""" 

8 SpaceWallet = apps.get_model("django_napse_core", "SpaceWallet") 

9 SpaceSimulationWallet = apps.get_model("django_napse_core", "SpaceSimulationWallet") 

10 

11 space = self.model( 

12 name=name, 

13 exchange_account=exchange_account, 

14 description=description, 

15 ) 

16 space.save() 

17 

18 SpaceWallet.objects.create(owner=space, title=f"Wallet for space {space.name}") 

19 SpaceSimulationWallet.objects.create(owner=space, title=f"Simulation Wallet for space {space.name}") 

20 

21 return space