49 lines
1.2 KiB
Python
49 lines
1.2 KiB
Python
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||
|
from django.http import HttpResponse
|
||
|
from django.shortcuts import render
|
||
|
from django.urls import reverse
|
||
|
from django.views import View
|
||
|
from mixins.views import (
|
||
|
ObjectCreate,
|
||
|
ObjectDelete,
|
||
|
ObjectList,
|
||
|
ObjectRead,
|
||
|
ObjectUpdate,
|
||
|
)
|
||
|
from two_factor.views.mixins import OTPRequiredMixin
|
||
|
|
||
|
from core.clients.platforms.agora import AgoraClient
|
||
|
from core.forms import AdForm
|
||
|
from core.models import Ad
|
||
|
from core.util import logs
|
||
|
from core.views.helpers import synchronize_async_helper
|
||
|
|
||
|
|
||
|
class AdList(LoginRequiredMixin, OTPRequiredMixin, ObjectList):
|
||
|
list_template = "partials/ad-list.html"
|
||
|
model = Ad
|
||
|
page_title = "List of ad connections"
|
||
|
|
||
|
list_url_name = "ads"
|
||
|
list_url_args = ["type"]
|
||
|
|
||
|
submit_url_name = "ad_create"
|
||
|
|
||
|
|
||
|
class AdCreate(LoginRequiredMixin, OTPRequiredMixin, ObjectCreate):
|
||
|
model = Ad
|
||
|
form_class = AdForm
|
||
|
|
||
|
submit_url_name = "ad_create"
|
||
|
|
||
|
|
||
|
class AdUpdate(LoginRequiredMixin, OTPRequiredMixin, ObjectUpdate):
|
||
|
model = Ad
|
||
|
form_class = AdForm
|
||
|
|
||
|
submit_url_name = "ad_update"
|
||
|
|
||
|
|
||
|
class AdDelete(LoginRequiredMixin, OTPRequiredMixin, ObjectDelete):
|
||
|
model = Ad
|