Add can_resolve_censorship permission and uncensor feature

- Add custom permission to Photo model
- Add PhotoUncensorView POST endpoint to restore private photos
- Show private photos to users with can_resolve_censorship
- Add restore button in lightgallery toolbar for censored photos
This commit is contained in:
krek0 2026-04-22 08:31:07 +02:00
parent 40352cffee
commit f5ccb40e16
6 changed files with 71 additions and 2 deletions

View file

@ -15,6 +15,7 @@ from .views import (
PhotoDeleteView,
PhotoDetailView,
PhotoReportView,
PhotoUncensorView,
TagDetail,
)
@ -41,6 +42,7 @@ urlpatterns = [
path("photo/<int:pk>/", PhotoDetailView.as_view(), name="pl-photo"),
path("photo/<int:pk>/delete/", PhotoDeleteView.as_view(), name="pl-photo-delete"),
path("photo/<int:pk>/report/", PhotoReportView.as_view(), name="pl-photo-report"),
path("photo/<int:pk>/uncensor/", PhotoUncensorView.as_view(), name="pl-photo-uncensor"),
path("upload/", GalleryUpload.as_view(), name="pl-gallery-upload"),
path("share/<uuid:token>/", GalleryPublicView.as_view(), name="pl-gallery-public"),
path("gallery/<slug:slug>/token/", GalleryTokenView.as_view(), name="pl-gallery-token"),