Commit 64213eab37786c25ec2704ed002baaf6721b2557

Authored by Bartłomiej Nitoń
1 parent 5a4c32c8

Semantic validation on old lemma version problem resolved.

semantics/validation.py
... ... @@ -7,7 +7,7 @@ from semantics.models import LexicalUnitExamples
7 7 from semantics.utils import get_matching_frame
8 8  
9 9 def validate_frames(lemma_id):
10   - lemma = Lemma.objects.get(id=lemma_id, old=False)
  10 + lemma = Lemma.objects.get(id=lemma_id)
11 11 actual_frames = lemma.entry_obj.actual_frames()
12 12 error_msg = u''
13 13 for frame in actual_frames.all():
... ...
semantics/views.py
... ... @@ -494,14 +494,17 @@ def get_ordered_lexical_units_bases(lexical_units_query):
494 494 @ajax(method='get')
495 495 def validate_semantics(request, lemma_id, new_status_id):
496 496 error_msg = ''
497   - try:
498   - status = Lemma_Status.objects.get(id=new_status_id)
499   - except Lemma_Status.DoesNotExist:
500   - status = None
501   - if status and status.check_semantics:
502   - error_msg = validate_frames(lemma_id)
503   - if not error_msg:
504   - error_msg = validate_lexical_units(lemma_id)
505   - if not error_msg:
506   - error_msg = validate_schemas(lemma_id)
  497 + if Lemma.objects.get(id=lemma_id).old:
  498 + error_msg = u'Odśwież hasło, widoczna wersja nie jest aktualna.'
  499 + else:
  500 + try:
  501 + status = Lemma_Status.objects.get(id=new_status_id)
  502 + except Lemma_Status.DoesNotExist:
  503 + status = None
  504 + if status and status.check_semantics:
  505 + error_msg = validate_frames(lemma_id)
  506 + if not error_msg:
  507 + error_msg = validate_lexical_units(lemma_id)
  508 + if not error_msg:
  509 + error_msg = validate_schemas(lemma_id)
507 510 return {'error_message': error_msg}
... ...