fix entities with ' in name

This commit is contained in:
j 2015-04-16 20:50:59 +05:30
parent 785e14082c
commit c59fb1596f

View file

@ -4,6 +4,7 @@ from __future__ import division
from django.conf import settings
import ox
from ox.utils import json
from ox.django.decorators import login_required_json
from ox.django.shortcuts import render_to_json_response, get_object_or_404_json, json_response, HttpErrorJson
@ -168,7 +169,7 @@ def addAnnotation(request, data):
if layer['canAddAnnotations'].get(request.user.get_profile().get_level()):
if layer['type'] == 'entity':
try:
value = Entity.get_by_name(data['value'], layer['entity']).get_id()
value = Entity.get_by_name(ox.decode_html(data['value']), layer['entity']).get_id()
except Entity.DoesNotExist:
response = json_response({})
response['status']['text'] = 'unkown entity'
@ -281,7 +282,7 @@ def editAnnotation(request, data):
if key in data:
if key == 'value' and layer['type'] == 'entity':
try:
value = Entity.get_by_name(data['value'], layer['entity']).get_id()
value = Entity.get_by_name(ox.decode_html(data['value']), layer['entity']).get_id()
except Entity.DoesNotExist:
response = json_response({})
response['status']['text'] = 'unkown entity'