Commit 66c280babae3c3978e9d259bf4c776e8988dc5d7

Authored by Bartłomiej Nitoń
1 parent 43da6c97

Saving lemma with not defined entry bugfix.

INSTALL_PL
... ... @@ -10,8 +10,8 @@ Zainstaluj Django w wersji 1.4.8:
10 10 Zainstaluj Django south:
11 11 >> sudo apt-get install python-django-south
12 12  
13   -Zainstaluj Django extensions:
14   ->> sudo apt-get install python-django-extensions
  13 +Zainstaluj Django extensions w wersji 1.6.7:
  14 +>> sudo pip install django-extensions==1.6.7
15 15  
16 16 Zainstaluj Django registration w wersji 0.8:
17 17 >> sudo pip install django-registration==0.8
... ...
dictionary/models.py
... ... @@ -1452,7 +1452,15 @@ class Entry(Model):
1452 1452  
1453 1453 def actual_lemma(self):
1454 1454 return self.lemmas.get(old=False)
1455   -
  1455 +
  1456 + def defined(self):
  1457 + entry_defined = True
  1458 + try:
  1459 + self.lemmas.get(old=False)
  1460 + except Lemma.DoesNotExist:
  1461 + entry_defined = False
  1462 + return entry_defined
  1463 +
1456 1464 def __unicode__(self):
1457 1465 return self.name
1458 1466  
... ...
dictionary/saving.py
... ... @@ -95,12 +95,10 @@ def get_disconnect_operations(lemma, frames, connections):
95 95 return operations
96 96  
97 97 def get_shared_schemata_ids(lemma):
98   - print lemma
99 98 ids = [f.id for f in lemma.frames.all()]
100   - print ids
101 99 for connected in lemma.entry_obj.rel_entries.all():
102   - ids += [f.id for f in connected.actual_lemma().frames.all()]
103   - print ids
  100 + if connected.defined():
  101 + ids += [f.id for f in connected.actual_lemma().frames.all()]
104 102 return ids
105 103  
106 104 def update_connections(lemma_id, reconnect_operations, user):
... ...
semantics/management/commands/find_hanging_connections.py
1 1 #-*- coding:utf-8 -*-
2 2  
3   -import datetime
4 3  
5 4 from django.core.management.base import BaseCommand
6 5  
... ... @@ -34,4 +33,3 @@ def find_hanging_connections():
34 33 print 'lemma: %s\tcomplement: %s\trealization: %s' % (lemma.entry_obj.name,
35 34 compl_ref,
36 35 unicode(real))
37   -
38 36 \ No newline at end of file
... ...
semantics/management/commands/find_hanging_examples.py
... ... @@ -38,5 +38,3 @@ def print_hanging_examples(lemma):
38 38 example.id)
39 39 for ex in same_lu_examples.all():
40 40 print 'lu_ex_id: %d' % ex.id
41   -
42   -
43 41 \ No newline at end of file
... ...
semantics/views.py
... ... @@ -283,11 +283,12 @@ def create_connected_context(lemma_id, user):
283 283 context = {'frames_display': [], 'connections':{'connected_reverse': [], 'connected': []}}
284 284  
285 285 for entry in connected:
286   - lemma = entry.actual_lemma()
287   - frame_context = create_frames_context(lemma.id, user)
288   - context['frames_display'] += frame_context['frames_display']
289   - context['connections']['connected'] += frame_context['connections']['connected']
290   - context['connections']['connected_reverse'] += frame_context['connections']['connected_reverse']
  286 + if entry.defined():
  287 + lemma = entry.actual_lemma()
  288 + frame_context = create_frames_context(lemma.id, user)
  289 + context['frames_display'] += frame_context['frames_display']
  290 + context['connections']['connected'] += frame_context['connections']['connected']
  291 + context['connections']['connected_reverse'] += frame_context['connections']['connected_reverse']
291 292  
292 293 return context
293 294  
... ...