Browse files

Merge pull request #2837 from mkoistinen/json_mime_type_for_2788

Add JSON MIME types to HttpResponse in resolve() per digi604's direction
  • Loading branch information...
2 parents 698fe1c + a165083 commit 20a4edca206bfc6cd8c6ad5707cd4d6ee4fc1213 @digi604 digi604 committed Mar 7, 2014
Showing with 5 additions and 5 deletions.
  1. +5 −5 cms/admin/pageadmin.py
View
10 cms/admin/pageadmin.py
@@ -1249,14 +1249,14 @@ def add_page_type(self, request):
def resolve(self, request):
if not request.user.is_staff:
- return HttpResponse('')
+ return HttpResponse('', content_type='application/json')
if request.session.get('cms_log_latest', False):
log = LogEntry.objects.get(pk=request.session['cms_log_latest'])
obj = log.get_edited_object()
del request.session['cms_log_latest']
if obj.__class__ in toolbar_pool.get_watch_models() and hasattr(obj, 'get_absolute_url'):
try:
- return HttpResponse(force_unicode(obj.get_absolute_url()))
+ return HttpResponse(force_unicode(obj.get_absolute_url()), content_type='application/json')
except:
pass
pk = request.REQUEST.get('pk')
@@ -1268,9 +1268,9 @@ def resolve(self, request):
try:
instance = ctype.get_object_for_this_type(pk=pk)
except ctype.model_class().DoesNotExist:
- return HttpResponse('/')
- return HttpResponse(force_unicode(instance.get_absolute_url()))
- return HttpResponse('')
+ return HttpResponse('/', content_type='application/json')
+ return HttpResponse(force_unicode(instance.get_absolute_url()), content_type='application/json')
+ return HttpResponse('', content_type='application/json')
def lookup_allowed(self, key, *args, **kwargs):
if key == 'site__exact':

0 comments on commit 20a4edc

Please sign in to comment.