Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Sayyid Hamid Mahdavi
4efb4ab664 get or create instead of get 2025-10-25 16:25:18 +03:30

View file

@ -354,7 +354,7 @@ class CategoryDepositVerifyAPIView(generics.RetrieveAPIView):
category = get_object_or_404(Category.objects.all(), uuid=category_uuid)
else:
category = None
wallet = Wallet.objects.get(owner_uuid=application.uuid, owner_type=TypeChoices.APPLICATION, category=category)
wallet, created = Wallet.objects.get_or_create(owner_uuid=application.uuid, owner_type=TypeChoices.APPLICATION, category=category)
return Transaction.objects.filter(application=application, payer_wallet=wallet).all()
def retrieve(self, request, *args, **kwargs):
@ -464,7 +464,7 @@ class CategoryWithdrawVerifyAPIView(generics.RetrieveAPIView):
category = get_object_or_404(Category.objects.all(), uuid=category_uuid)
else:
category = None
wallet = Wallet.objects.get(owner_uuid=application.uuid, owner_type=TypeChoices.APPLICATION, category=category)
wallet, created = Wallet.objects.get_or_create(owner_uuid=application.uuid, owner_type=TypeChoices.APPLICATION, category=category)
return Transaction.objects.filter(application=application, payee_wallet=wallet).all()
def retrieve(self, request, *args, **kwargs):