Commits

Yohan Boniface committed de1ad7c

Do not use the commit_manually for all the upload view (fix #54)

  • Participants
  • Parent commits 867a2ba

Comments (0)

Files changed (2)

 - Marker has now icon_class and pictogram fields (https://github.com/yohanboniface/django-leaflet-storage/issues/21)
 - handle scale control
 - basic short URL management
+- fixed a bug where imports were failing if the category had a custom marker image
 
 ## 0.1.0
 

leaflet_storage/views.py

         })
         return super(UploadData, self).get_context_data(**kwargs)
 
-    @transaction.commit_manually
     def form_valid(self, form):
         FEATURE_TO_MODEL = {
             'Point': Marker,
                                 kwargs['options'] = {}
                             kwargs['options'][name] = value
                         break
-            try:
-                klass.objects.create(**kwargs)
-            except DatabaseError:
-                transaction.rollback()
-                continue  # TODO notify user
-            else:
-                transaction.commit()
+            with transaction.commit_manually():
+                try:
+                    klass.objects.create(**kwargs)
+                except DatabaseError:
+                    transaction.rollback()
+                    continue  # TODO notify user
+                else:
+                    transaction.commit()
             counter += 1
         kwargs = {
             'category': category.json,