Skip to content

Commit

Permalink
Merge branch 'master' of github.com:nanvel/django-nicedit
Browse files Browse the repository at this point in the history
  • Loading branch information
nanvel committed Feb 7, 2015
2 parents 2108f7a + a26cfc0 commit 86e67a9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions nicedit/views.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
from django.utils import simplejson
try:
from django.utils import simplejson as json
except ImportError:
import json
from django.http import HttpResponse

from .forms import NicEditImageForm


def upload(request):
if not request.user.is_authenticated():
json = simplejson.dumps({
json_data = json.dumps({
'success': False,
'errors': {'__all__': 'Authentication required'}})
return HttpResponse(json, mimetype='application/json')
return HttpResponse(json_data, mimetype='application/json')
form = NicEditImageForm(request.POST or None, request.FILES or None)
if form.is_valid():
image = form.save()
json = simplejson.dumps({
json_data = json.dumps({
'success': True,
'upload': {
'links': {
Expand All @@ -24,6 +27,6 @@ def upload(request):
}
})
else:
json = simplejson.dumps({
json_data = json.dumps({
'success': False, 'errors': form.errors})
return HttpResponse(json, mimetype='application/json')
return HttpResponse(json_data, mimetype='application/json')
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def read(fname):
platforms=['OS Independent'],
keywords='django, nicedit, widget, rte',
author='Oleksandr Polyeno',
author_email='polyeno.com',
author_email='polyenoom@gmail.com',
url="https://github.com/nanvel/django-nicedit",
packages=find_packages(),
include_package_data=True,
Expand Down

0 comments on commit 86e67a9

Please sign in to comment.