pluto/core/views/aggregators.py

45 lines
1.1 KiB
Python

from django.contrib.auth.mixins import LoginRequiredMixin
from mixins.views import (
ObjectCreate,
ObjectDelete,
ObjectList,
ObjectRead,
ObjectUpdate,
)
from two_factor.views.mixins import OTPRequiredMixin
from core.forms import AggregatorForm
from core.models import Aggregator
from core.util import logs
log = logs.get_logger(__name__)
class AggregatorList(LoginRequiredMixin, OTPRequiredMixin, ObjectList):
list_template = "partials/aggregator-list.html"
model = Aggregator
page_title = "List of aggregator connections"
list_url_name = "aggregators"
list_url_args = ["type"]
submit_url_name = "aggregator_create"
class AggregatorCreate(LoginRequiredMixin, OTPRequiredMixin, ObjectCreate):
model = Aggregator
form_class = AggregatorForm
submit_url_name = "aggregator_create"
class AggregatorUpdate(LoginRequiredMixin, OTPRequiredMixin, ObjectUpdate):
model = Aggregator
form_class = AggregatorForm
submit_url_name = "aggregator_update"
class AggregatorDelete(LoginRequiredMixin, OTPRequiredMixin, ObjectDelete):
model = Aggregator