Add payouts
This commit is contained in:
82
core/views/payouts.py
Normal file
82
core/views/payouts.py
Normal file
@@ -0,0 +1,82 @@
|
||||
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 PayoutForm
|
||||
from core.models import Payout
|
||||
|
||||
|
||||
class PayoutList(LoginRequiredMixin, OTPRequiredMixin, ObjectList):
|
||||
list_template = "partials/payout-list.html"
|
||||
model = Payout
|
||||
page_title = "List of payouts"
|
||||
page_subtitle = (
|
||||
"Payouts are informational only. "
|
||||
"Adjustments and creations will not have any effect."
|
||||
)
|
||||
|
||||
list_url_name = "payouts"
|
||||
list_url_args = ["type"]
|
||||
|
||||
submit_url_name = "payout_create"
|
||||
|
||||
# def get_context_data(self):
|
||||
# context = super().get_context_data()
|
||||
# self.extra_buttons = [
|
||||
# {
|
||||
# "url": reverse("ad_dist"),
|
||||
# "action": "distribute",
|
||||
# "method": "get",
|
||||
# "label": "Distribute ads",
|
||||
# "icon": "fa-solid fa-upload",
|
||||
# },
|
||||
# {
|
||||
# "url": reverse("ad_redist"),
|
||||
# "action": "redistribute",
|
||||
# "method": "get",
|
||||
# "label": "Update ads",
|
||||
# "icon": "fa-solid fa-refresh",
|
||||
# },
|
||||
# {
|
||||
# "url": reverse("cheat"),
|
||||
# "action": "cheat",
|
||||
# "method": "get",
|
||||
# "label": "Run cheat",
|
||||
# "icon": "fa-solid fa-bolt",
|
||||
# },
|
||||
# {
|
||||
# "url": reverse("ad_nuke"),
|
||||
# "action": "nuke",
|
||||
# "method": "get",
|
||||
# "label": "Nuke ads",
|
||||
# "icon": "fa-solid fa-bomb",
|
||||
# "confirm": True,
|
||||
# },
|
||||
# {
|
||||
# "url": reverse("ad_dedup"),
|
||||
# "action": "deduplicate",
|
||||
# "method": "get",
|
||||
# "label": "Deduplicate ads",
|
||||
# "icon": "fa-thin fa-copy",
|
||||
# "confirm": True,
|
||||
# },
|
||||
# ]
|
||||
# return context
|
||||
|
||||
|
||||
class PayoutCreate(LoginRequiredMixin, OTPRequiredMixin, ObjectCreate):
|
||||
model = Payout
|
||||
form_class = PayoutForm
|
||||
|
||||
submit_url_name = "payout_create"
|
||||
|
||||
|
||||
class PayoutUpdate(LoginRequiredMixin, OTPRequiredMixin, ObjectUpdate):
|
||||
model = Payout
|
||||
form_class = PayoutForm
|
||||
|
||||
submit_url_name = "payout_update"
|
||||
|
||||
|
||||
class PayoutDelete(LoginRequiredMixin, OTPRequiredMixin, ObjectDelete):
|
||||
model = Payout
|
||||
Reference in New Issue
Block a user