Commit d9bc6c8af96940a5d5b8640ed9e68894cc184918

Authored by Tomasz Bartosiak
1 parent ff3aabf3

Wstęp do wyświetlania jednostek leksykalnych -- frazeologizmów

Showing 1 changed file with 5 additions and 3 deletions
semantics/views.py
... ... @@ -77,7 +77,7 @@ def reorder_history(frames_list):
77 77 def ajax_frames(request, lemma_id):
78 78  
79 79 lemma = Lemma.objects.get(id=lemma_id, old=False)
80   - lexical_units = LexicalUnit.objects.filter(Q(base = lemma.entry)|Q(base = lemma.entry + u' się')).order_by('sense')
  80 + lexical_units = LexicalUnit.objects.filter(Q(base__startswith=lemma.entry + u' ')|Q(base__contains=u' '+lemma.entry+u' ')|Q(base__endswith=u' '+lemma.entry)|Q(base=lemma.entry)).order_by('sense')
81 81  
82 82 alternations = {}
83 83 frames_dict = {}
... ... @@ -97,7 +97,8 @@ def ajax_frames(request, lemma_id):
97 97 if t not in type_frames:
98 98 type_frames[t] = []
99 99 type_frames[tuple(frame_units[frame_id])].append(frames_dict[frame_id])
100   -
  100 +
  101 +# ala[ma]=kot
101 102  
102 103 frames_display = []
103 104 complement_arguments = {}
... ... @@ -209,7 +210,8 @@ def ajax_frames(request, lemma_id):
209 210 @ajax(method='get', encode_result=False)
210 211 def ajax_units(request, lemma_id):
211 212 lemma = Lemma.objects.get(id=lemma_id, old=False)
212   - lexical_units = LexicalUnit.objects.filter(Q(base = lemma.entry, pos="czasownik")|Q(base = lemma.entry + u' się', pos="czasownik")).order_by('base', 'sense')
  213 +# lexical_units = LexicalUnit.objects.filter(Q(base = lemma.entry, pos="czasownik")|Q(base = lemma.entry + u' się', pos="czasownik")).order_by('base', 'sense')
  214 + lexical_units = LexicalUnit.objects.filter(Q(base__startswith=lemma.entry + u' ', pos="czasownik")|Q(base__contains=u' '+lemma.entry+u' ', pos="czasownik")|Q(base__endswith=u' '+lemma.entry, pos="czasownik")|Q(base=lemma.entry, pos="czasownik")).order_by('base', 'sense')
213 215  
214 216 context = {
215 217 'lexical_units': [{"id": lu.id, "luid": lu.luid, "base": lu.base, "sense": lu.sense, "pos": lu.pos, "glossa": lu.glossa, "definition": lu.definition} for lu in lexical_units],
... ...