This commit is contained in:
Markos Gogoulos
2026-04-26 16:21:49 +03:00
parent a9b708dad8
commit f2152d4926
2 changed files with 15 additions and 15 deletions
+11 -11
View File
@@ -673,17 +673,17 @@ class MediaBulkUserActions(APIView):
return Response({"detail": "No matching categories found or access denied"}, status=status.HTTP_400_BAD_REQUEST)
added_count = 0
tag = None
for category in categories:
if category.is_lms_course:
tag, _ = Tag.objects.get_or_create(title=category.title[:100])
for m in media:
if not m.category.filter(uid=category.uid).exists():
m.category.add(category)
added_count += 1
if tag:
m.tags.add(tag)
# tag = None
# for category in categories:
# if category.is_lms_course:
# tag, _ = Tag.objects.get_or_create(title=category.title[:100])
#
# for m in media:
# if not m.category.filter(uid=category.uid).exists():
# m.category.add(category)
# added_count += 1
# if tag:
# m.tags.add(tag)
return Response({"detail": f"Added {added_count} media items to {categories.count()} categories"})