Implement profit sharing system and write tests

This commit is contained in:
2023-03-20 11:06:37 +00:00
parent 8c490d6ee3
commit 9627fb7d41
11 changed files with 411 additions and 4 deletions

View File

@@ -2,8 +2,8 @@ from django.contrib.auth.mixins import LoginRequiredMixin
from mixins.views import ObjectCreate, ObjectDelete, ObjectList, ObjectUpdate
from two_factor.views.mixins import OTPRequiredMixin
from core.forms import WalletForm
from core.models import Wallet
from core.forms import OperatorWalletsForm, WalletForm
from core.models import OperatorWallets, Wallet
class WalletList(LoginRequiredMixin, OTPRequiredMixin, ObjectList):
@@ -33,3 +33,21 @@ class WalletUpdate(LoginRequiredMixin, OTPRequiredMixin, ObjectUpdate):
class WalletDelete(LoginRequiredMixin, OTPRequiredMixin, ObjectDelete):
model = Wallet
class OperatorWalletsUpdate(LoginRequiredMixin, ObjectUpdate):
model = OperatorWallets
form_class = OperatorWalletsForm
page_title = "Update your designated wallets."
submit_url_name = "operator_wallets_update"
submit_url_args = ["type"]
pk_required = False
hide_cancel = True
def get_object(self, **kwargs):
wallet, _ = OperatorWallets.objects.get_or_create(user=self.request.user)
return wallet