.
This commit is contained in:
+7
-7
@@ -15,7 +15,7 @@ from django_tables2 import SingleTableView, SingleTableMixin
|
||||
class EntryUpdateView(UpdateView):
|
||||
model = Entry
|
||||
template_name = "oef/entry_update_view.html"
|
||||
fields = ['modality', 'exam_code', 'exam_name', 'questions', 'comments']
|
||||
fields = ['modality', 'exam_code', 'exam_name', 'questions', 'comments', "inactive"]
|
||||
|
||||
class EntryDetailView(DetailView):
|
||||
model = Entry
|
||||
@@ -48,7 +48,7 @@ def formats_apply(request, pk):
|
||||
|
||||
search_text = format.get_format()
|
||||
|
||||
entries = Entry.objects.filter(questions__icontains=search_text)
|
||||
entries = Entry.objects.filter(questions__icontains=search_text, inactive=False)
|
||||
|
||||
entry_list = []
|
||||
for entry in entries:
|
||||
@@ -79,9 +79,9 @@ def replace_questions(request):
|
||||
return HttpResponse("Please provide both search and replace values")
|
||||
|
||||
if request.POST.get("exact", False):
|
||||
entries = Entry.objects.filter(questions=search)
|
||||
entries = Entry.objects.filter(questions=search, inactive=False)
|
||||
else:
|
||||
entries = Entry.objects.filter(questions__contains=search)
|
||||
entries = Entry.objects.filter(questions__contains=search, inactive=False)
|
||||
|
||||
for entry in entries:
|
||||
entry.questions = entry.questions.replace(search, replace)
|
||||
@@ -92,7 +92,7 @@ def replace_questions(request):
|
||||
return render(request, "oef/replace_questions.html", {})
|
||||
|
||||
def questions(request):
|
||||
questions = set(Entry.objects.all().values_list("questions", flat=True))
|
||||
questions = set(Entry.objects.filter(inactive=False).values_list("questions", flat=True))
|
||||
|
||||
questions = sorted(questions, key=lambda x: len(x))
|
||||
|
||||
@@ -111,7 +111,7 @@ def entries_by_question(request):
|
||||
|
||||
if request.method == "POST":
|
||||
question = request.POST.get("question")
|
||||
entries = Entry.objects.filter(questions=question)
|
||||
entries = Entry.objects.filter(questions=question, inactive=False)
|
||||
|
||||
return render(request, "oef/entries_by_question.html", {"entries": entries})
|
||||
|
||||
@@ -121,7 +121,7 @@ def entries_by_question_codes(request):
|
||||
|
||||
if request.method == "POST":
|
||||
question = request.POST.get("question")
|
||||
entries = Entry.objects.filter(questions=question)
|
||||
entries = Entry.objects.filter(questions=question, inactive=False)
|
||||
|
||||
return render(request, "oef/entries_by_question_codes.html", {"entries": entries})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user