This commit is contained in:
Markos Gogoulos
2026-03-15 17:59:04 +02:00
parent a09c5904e1
commit b3f7669f53

View File

@@ -673,11 +673,17 @@ class MediaBulkUserActions(APIView):
return Response({"detail": "No matching categories found"}, status=status.HTTP_400_BAD_REQUEST)
removed_count = 0
tag = None
for category in categories:
if category.is_lms_course:
tag = Tag.objects.filter(title=category.title[:100]).first()
for m in media:
if m.category.filter(uid=category.uid).exists():
m.category.remove(category)
removed_count += 1
if tag:
m.tags.remove(tag)
return Response({"detail": f"Removed {removed_count} media items from {categories.count()} categories"})