Commits

kmike  committed 5434264

More preparations for image uploader.

  • Participants
  • Parent commits ef2ec70

Comments (0)

Files changed (1)

File photo_albums/views.py

     album_site.check_permissions(request, obj)
 
     success_url = '../' # album_site.reverse('show_album', args=[object_id])
+
     FormsetCls = album_site.upload_formset_class
 
     if request.method == 'POST':
                 photo.user = request.user
                 photo.content_object = obj
                 photo.save()
+            if request.is_ajax():
+                return HttpResponse()
             return HttpResponseRedirect(success_url) # Redirect after POST
+        else:
+            if request.is_ajax():
+                return HttpResponse(formset.errors)
     else:
         formset = FormsetCls(queryset = AttachedImage.objects.none())