Convert page type usage view to a class-based view

pull/10592/head
Matt Westcott 2023-06-22 14:25:11 +01:00 zatwierdzone przez Sage Abdullah
rodzic ce5a8a33eb
commit aa81dfd6fe
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: EB1A33CC51CC0217
2 zmienionych plików z 31 dodań i 29 usunięć

Wyświetl plik

@ -34,7 +34,7 @@ urlpatterns = [
),
path(
"usage/<slug:content_type_app_name>/<slug:content_type_model_name>/",
usage.content_type_use,
usage.ContentTypeUseView.as_view(),
name="type_use",
),
path("<int:page_id>/usage/", usage.UsageView.as_view(), name="usage"),

Wyświetl plik

@ -3,12 +3,14 @@ from django.core.exceptions import PermissionDenied
from django.core.paginator import Paginator
from django.http import Http404
from django.template.response import TemplateResponse
from django.views.generic import View
from wagtail.admin.views import generic
from wagtail.models import Page
def content_type_use(request, content_type_app_name, content_type_model_name):
class ContentTypeUseView(View):
def get(self, request, content_type_app_name, content_type_model_name):
try:
content_type = ContentType.objects.get_by_natural_key(
content_type_app_name, content_type_model_name