2022-11-17 23:09:04 -08:00
|
|
|
from django import forms
|
|
|
|
from django.utils.decorators import method_decorator
|
|
|
|
from django.views.generic import FormView, RedirectView, TemplateView
|
|
|
|
|
|
|
|
from users.decorators import admin_required
|
|
|
|
from users.models import Identity, User
|
|
|
|
from users.views.admin.domains import ( # noqa
|
|
|
|
DomainCreate,
|
|
|
|
DomainDelete,
|
|
|
|
DomainEdit,
|
|
|
|
Domains,
|
|
|
|
)
|
2022-11-25 16:52:43 -08:00
|
|
|
from users.views.admin.federation import FederationEdit, FederationRoot # noqa
|
2022-11-28 20:41:36 -08:00
|
|
|
from users.views.admin.hashtags import ( # noqa
|
|
|
|
HashtagCreate,
|
|
|
|
HashtagDelete,
|
|
|
|
HashtagEdit,
|
|
|
|
Hashtags,
|
|
|
|
)
|
2022-12-05 09:55:30 -08:00
|
|
|
from users.views.admin.settings import BasicSettings, TuningSettings # noqa
|
2022-11-17 23:09:04 -08:00
|
|
|
|
|
|
|
|
|
|
|
@method_decorator(admin_required, name="dispatch")
|
|
|
|
class AdminRoot(RedirectView):
|
|
|
|
pattern_name = "admin_basic"
|
|
|
|
|
|
|
|
|
|
|
|
@method_decorator(admin_required, name="dispatch")
|
|
|
|
class Users(TemplateView):
|
|
|
|
|
|
|
|
template_name = "admin/users.html"
|
|
|
|
|
|
|
|
def get_context_data(self):
|
|
|
|
return {
|
|
|
|
"users": User.objects.order_by("email"),
|
|
|
|
"section": "users",
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@method_decorator(admin_required, name="dispatch")
|
|
|
|
class Identities(TemplateView):
|
|
|
|
|
|
|
|
template_name = "admin/identities.html"
|
|
|
|
|
|
|
|
def get_context_data(self):
|
|
|
|
return {
|
|
|
|
"identities": Identity.objects.order_by("username"),
|
|
|
|
"section": "identities",
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@method_decorator(admin_required, name="dispatch")
|
|
|
|
class Invites(FormView):
|
|
|
|
|
|
|
|
template_name = "admin/invites.html"
|
|
|
|
extra_context = {"section": "invites"}
|
|
|
|
|
|
|
|
class form_class(forms.Form):
|
|
|
|
note = forms.CharField()
|
|
|
|
|
|
|
|
def get_context_data(self, *args, **kwargs):
|
|
|
|
context = super().get_context_data(*args, **kwargs)
|
|
|
|
return context
|