kopia lustrzana https://github.com/wagtail/wagtail
Use ChosenViewMixin for image chosen view
rodzic
e831d8e6cc
commit
da33faf220
|
@ -39,7 +39,7 @@ urlpatterns = [
|
|||
"chooser/results/", chooser.ChooseResultsView.as_view(), name="chooser_results"
|
||||
),
|
||||
path(
|
||||
"chooser/<int:image_id>/",
|
||||
"chooser/chosen/<str:pk>/",
|
||||
chooser.ImageChosenView.as_view(),
|
||||
name="image_chosen",
|
||||
),
|
||||
|
|
|
@ -17,6 +17,7 @@ from wagtail.admin.views.generic.chooser import (
|
|||
ChooseResultsViewMixin,
|
||||
ChooseViewMixin,
|
||||
ChosenResponseMixin,
|
||||
ChosenViewMixin,
|
||||
CreationFormMixin,
|
||||
)
|
||||
from wagtail.admin.views.generic.permissions import PermissionCheckedMixin
|
||||
|
@ -187,10 +188,10 @@ class ChooseResultsView(
|
|||
pass
|
||||
|
||||
|
||||
class ImageChosenView(ImageChosenResponseMixin, View):
|
||||
def get(self, request, image_id):
|
||||
image = get_object_or_404(get_image_model(), id=image_id)
|
||||
return self.get_chosen_response(image)
|
||||
class ImageChosenView(ChosenViewMixin, ImageChosenResponseMixin, View):
|
||||
def get(self, request, *args, pk, **kwargs):
|
||||
self.model = get_image_model()
|
||||
return super().get(request, *args, pk, **kwargs)
|
||||
|
||||
|
||||
def duplicate_found(request, new_image, existing_image):
|
||||
|
|
Ładowanie…
Reference in New Issue