Exemple #1
0
def search_tutors(request):
    tutors_qs = Tutor.objects.none()
    form = TutorSearchForm(data=request.GET)

    if form.is_valid():
        tutors_qs = form.search()

    tutors = paginate_queryset(tutors_qs, request.GET)

    return render(request, "search/search.html", {
        "form": form,
        "tutors": tutors
    })
Exemple #2
0
    def test_form_fields(self):
        FORM_FIELDS = ("name", )
        form = TutorSearchForm()

        self.assertCountEqual(FORM_FIELDS, list(form.fields.keys()))
Exemple #3
0
    def test_form_fields(self):
        form_fields = ("name", )
        form = TutorSearchForm()

        self.assertCountEqual(form_fields, list(form.fields.keys()))