Commit 671e2d430db7d30f2cb10126697554b8f6f7236d

Authored by Marcel Kawski
1 parent 6fb74457

Choose only document with not broken source for annotation and documents list

Showing 1 changed file with 6 additions and 3 deletions
collector/storage/views.py
... ... @@ -825,7 +825,8 @@ class StartAnnotationView(UserPassesTestMixin, RedirectView):
825 825  
826 826 def get(self, request, *args, **kwargs):
827 827 new_documents = Document.objects.filter(parent__isnull=True,
828   - processing_status=ProcessingStatus.objects.get(key='to_correct'))
  828 + processing_status=ProcessingStatus.objects.get(key='to_correct'),
  829 + broken_source=False)
829 830 if len(new_documents) == 0:
830 831 messages.error(request, 'Brak dokumentów dostępnych do anotacji')
831 832 return HttpResponseRedirect(reverse('annotation'))
... ... @@ -1028,9 +1029,11 @@ class DocumentListView(ListView):
1028 1029 docs = Document.objects.filter(Q(name__icontains=filter_val) |
1029 1030 Q(id__istartswith=filter_val) |
1030 1031 Q(annotations__user__username__icontains=filter_val),
1031   - parent__isnull=True)
  1032 + parent__isnull=True,
  1033 + broken_source=False)
1032 1034 else:
1033   - docs = Document.objects.filter(parent__isnull=True)
  1035 + docs = Document.objects.filter(parent__isnull=True,
  1036 + broken_source=False)
1034 1037  
1035 1038 if order == 'desc':
1036 1039 docs = docs.order_by("-" + order_by)
... ...