Commit d3dcde9bccfea168af1b605a5e996e5e25787a17
1 parent
71ad2c03
Zapis jednostek frazeologicznych
Showing
1 changed file
with
4 additions
and
3 deletions
semantics/saving.py
@@ -12,16 +12,17 @@ from wordnet.models import Hypernymy, LexicalUnit, Synonymy, Synset | @@ -12,16 +12,17 @@ from wordnet.models import Hypernymy, LexicalUnit, Synonymy, Synset | ||
12 | 12 | ||
13 | def modify_frames(lemma_id, operations, user): | 13 | def modify_frames(lemma_id, operations, user): |
14 | store_old_versions(lemma_id, operations, user) | 14 | store_old_versions(lemma_id, operations, user) |
15 | - make_operations(operations) | 15 | + make_operations(lemma_id, operations) |
16 | 16 | ||
17 | -def make_operations(operations): | 17 | +def make_operations(lemma_id, operations): |
18 | translation = {'unit_id': {}, 'frame_id': {}, 'complement_id': {}, 'preference_id': {}} | 18 | translation = {'unit_id': {}, 'frame_id': {}, 'complement_id': {}, 'preference_id': {}} |
19 | + entry = Lemma.objects.get(id=lemma_id).entry_obj | ||
19 | for operation in operations: | 20 | for operation in operations: |
20 | if operation['operation'] == "create_frame": | 21 | if operation['operation'] == "create_frame": |
21 | luids = [int(m['id']) for m in operation['meanings']] | 22 | luids = [int(m['id']) for m in operation['meanings']] |
22 | translation['frame_id'][int(operation['id'])] = create_frame(luids) | 23 | translation['frame_id'][int(operation['id'])] = create_frame(luids) |
23 | elif operation['operation'] == "add_unit": | 24 | elif operation['operation'] == "add_unit": |
24 | - translation['unit_id'][int(operation['unit']['id'])] = add_unit(operation['unit']) | 25 | + translation['unit_id'][int(operation['unit']['id'])] = add_unit(entry, operation['unit']) |
25 | elif operation['operation'] == "remove_frame": | 26 | elif operation['operation'] == "remove_frame": |
26 | if int(operation['id']) in translation['frame_id']: | 27 | if int(operation['id']) in translation['frame_id']: |
27 | frame_id = translation['frame_id'][int(operation['id'])] | 28 | frame_id = translation['frame_id'][int(operation['id'])] |