Commits

Maciej Wiśniowski committed 9d2fdf1

Fixed issue #24: Update images/files fails when called during upload.

Comments (0)

Files changed (1)

lfc/manage/views.py

         message = _(u"Images has been updated.")
 
         for image in obj.images.all():
-            image.title = request.POST.get("title-%s" % image.id)
-            image.position = request.POST.get("position-%s" % image.id)
-            image.save()
+            if "title-%s" % image.id in request.POST.keys():
+                image.title = request.POST.get("title-%s" % image.id)
+                image.position = request.POST.get("position-%s" % image.id)
+                image.save()
 
     # Refresh positions
     for i, image in enumerate(obj.images.all()):
         message = _(u"Files has been updated.")
 
         for file in obj.files.all():
-            file.title = request.POST.get("title-%s" % file.id)
-            file.position = request.POST.get("position-%s" % file.id)
-            file.save()
+            if "title-%s" % image.id in request.POST.keys():
+                file.title = request.POST.get("title-%s" % file.id)
+                file.position = request.POST.get("position-%s" % file.id)
+                file.save()
 
     # Refresh positions
     for i, file in enumerate(obj.files.all()):