Coverage for django_napse/core/models/wallets/managers/wallet.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
4from django_napse.utils.errors import WalletError
7class WalletManager(models.Manager):
8 def create(self, title: str, owner):
9 """Create the wallet."""
10 if self.model == apps.get_model("django_napse_core", "Wallet"):
11 error_msg = "WalletManager cannot create a Wallet object. Use a subclass instead."
12 raise WalletError.CreateError(error_msg)
14 return super().create(
15 title=title,
16 owner=owner,
17 )