def teachers_list(request):
qs = Teacher.objects.all()
q = Q()
if request.GET.get('fname):
q &= Q(first_name='fname')
if request.GET.get('lname):
q &= Q(last_name='lname')
if request.GET.get('email'):
q &= Q(email='email')
qs = qs.filter(q)
result = '<br>'.join(
str(teacher)
for teacher in qs
)
return render(
request=request,
template_name='teachers_list.html',
context={'teachers_list': result}
)
def teachers_list(request):
qs = Teacher.objects.all()
q = Q()
if request.GET.get('fname):
q &= Q(first_name='fname')
if request.GET.get('lname):
q &= Q(last_name='lname')
if request.GET.get('email'):
q &= Q(email='email')
qs = qs.filter(q)
result = '<br>'.join(
str(teacher)
for teacher in qs
)
return render(
request=request,
template_name='teachers_list.html',
context={'teachers_list': result}
)