Files
goodtimes/manage_wallets/views.py
rizwanisready db213d3228 wrong commit
2024-02-29 13:25:50 +05:30

35 lines
1.1 KiB
Python

from django.shortcuts import render
from django.contrib.auth.mixins import LoginRequiredMixin
from accounts import resource_action
from django.views import generic
from .models import Wallet, Transaction
"""Wallet Related VIew"""
class WalletListView(LoginRequiredMixin, generic.TemplateView):
page_name = resource_action.RESOURCE_MANAGE_WALLET
template_name = "manage_wallets/wallet_list.html"
model = Wallet
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["page_name"] = self.page_name
context["wallet_objs"] = Wallet.objects.filter(deleted=False)
return context
"""Payment Related View"""
class PaymentListView(LoginRequiredMixin, generic.TemplateView):
page_name = resource_action.RESOURCE_MANAGE_PAYMENT
template_name = "manage_wallets/payment_list.html"
model = Transaction
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["page_name"] = self.page_name
context["transaction_objs"] = Transaction.objects.filter(deleted=False)
return context