|
@@ -120,7 +120,7 @@ class LangAVSSView(TemplateView):
|
|
|
for location in locations:
|
|
|
# print(location['filename'])
|
|
|
# print(location['line'])
|
|
|
- langlocaltionmodel = LangLocationModel.objects.filter(lk=lkModel,
|
|
|
+ langlocaltionmodel = LangLocationModel.objects.filter(lk=lkModel.id,
|
|
|
filename=location['filename'])
|
|
|
if langlocaltionmodel.exists():
|
|
|
langlocaltionmodel.update(line=location['line'])
|
|
@@ -175,16 +175,15 @@ class LangAVSSView(TemplateView):
|
|
|
la_id = translation['la_id']
|
|
|
val = translation['val']
|
|
|
addTime = int(time.time())
|
|
|
- langval = LangValModel.objects.filter(la=la_id, lk=lkModel)
|
|
|
+ langval = LangValModel.objects.filter(la=la_id, lk=lkModel.id)
|
|
|
if langval.exists():
|
|
|
langval.update(word_val=val, updTime=addTime)
|
|
|
else:
|
|
|
- langArea = LangAreaModel.objects.filter(id=la_id)[0]
|
|
|
# 插入key对应的value
|
|
|
# 插入新的key
|
|
|
langValue = {
|
|
|
- 'lk': lkModel,
|
|
|
- 'la': langArea,
|
|
|
+ 'lk': lkModel.id,
|
|
|
+ 'la': la_id,
|
|
|
'word_val': val,
|
|
|
'addTime': addTime,
|
|
|
'updTime': addTime,
|
|
@@ -202,20 +201,20 @@ class LangAVSSView(TemplateView):
|
|
|
LangKeyClassModel.objects.create(**langKeyClass)
|
|
|
|
|
|
# 语言的在代码中的位置
|
|
|
- locations = list(location_array)
|
|
|
- for location in locations:
|
|
|
- # print(location['filename'])
|
|
|
- # print(location['line'])
|
|
|
- langlocation = LangLocationModel.objects.filter(lk=lkModel.id, filename=location['filename'])
|
|
|
- if langlocation.exists():
|
|
|
- langlocation.update(line=location['line'])
|
|
|
- else:
|
|
|
- locationValue = {
|
|
|
- 'lk': lkModel,
|
|
|
- 'filename': location['filename'],
|
|
|
- 'line': location['line']
|
|
|
- }
|
|
|
- LangLocationModel.objects.create(**locationValue)
|
|
|
+ locations = list(location_array)
|
|
|
+ for location in locations:
|
|
|
+ # print(location['filename'])
|
|
|
+ # print(location['line'])
|
|
|
+ langlocation = LangLocationModel.objects.filter(lk=lkModel.id, filename=location['filename'])
|
|
|
+ if langlocation.exists():
|
|
|
+ langlocation.update(line=location['line'])
|
|
|
+ else:
|
|
|
+ locationValue = {
|
|
|
+ 'lk': lkModel,
|
|
|
+ 'filename': location['filename'],
|
|
|
+ 'line': location['line']
|
|
|
+ }
|
|
|
+ LangLocationModel.objects.create(**locationValue)
|
|
|
return response.json(0)
|
|
|
else:
|
|
|
return response.json(444)
|