Coverage for django_napse/core/models/accounts/managers/exchange.py: 100%
9 statements
« prev ^ index » next coverage.py v7.4.3, created at 2024-03-12 13:49 +0000
« 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
5class ExchangeAccountManager(models.Manager):
6 def create(
7 self,
8 exchange,
9 testing: bool,
10 name: str,
11 description: str = "",
12 **kwargs,
13 ):
14 NapseSpace = apps.get_model("django_napse_core", "NapseSpace")
15 exchange_account = self.model(
16 exchange=exchange,
17 name=name,
18 description=description,
19 testing=testing,
20 **kwargs,
21 )
22 exchange_account.save()
23 NapseSpace.objects.create(
24 name=exchange_account.name,
25 description=f"This is the main space for the {exchange_account.name} exchange account.",
26 exchange_account=exchange_account,
27 )
28 return exchange_account