Answer the question
In order to leave comments, you need to log in
Djfngo filter data in alphabetical range?
there are buttons "A-B", "M-F", etc. how to make that when clicking on the button, the data from the database is displayed in the appropriate range.
I'll ask a different question.
def filter_symbol(request):
f = StartFilter(request.GET, queryset=Staff.objects.filter(Q(name__startswith='А') | Q(name__startswith='Б')
| Q(name__startswith='В') | Q(name__startswith='Г')))
Answer the question
In order to leave comments, you need to log in
def filter_symbol(request):
letter_filter = Q()
for letter in 'АБВГ':
letter_filter |= Q(name__startswith=letter)
f = StartFilter(request.GET, queryset=Staff.objects.filter(letter_filter)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question