feat: fix thumbnails button

This commit is contained in:
relikd
2025-06-12 00:56:37 +02:00
parent b98b882665
commit a78c8da503
6 changed files with 51 additions and 6 deletions

23
backend/app/urls.py Normal file
View File

@@ -0,0 +1,23 @@
from django.http import HttpRequest, JsonResponse
from django.urls import path
from app.models.place import Place
def run_tool(request: HttpRequest):
if request.method != 'POST':
return JsonResponse({'error': 'unsupported method type'})
action = request.POST.get('action')
if action == 'generate-thumbnails':
Place.recreateThumbnails()
else:
return JsonResponse({'error': 'unknown action'})
return JsonResponse({'success': 'ok'})
urlpatterns = [
path('tool/', run_tool, name='exec-tool'),
]