Enhance destinataer list: 50 entries per page + default sort by last name
🎯 Improvements Made: - Increased pagination from 20 to 50 entries per page - Added default sorting by last name (nachname) in ascending order - Added visual sorting indicators with Font Awesome icons (up/down arrows) - Added results info showing current page range and total count - Display shows sorting method when active 📊 User Experience: - List now shows 50 destinataers by default (as requested) - Always sorted by last name for consistent browsing - Clear visual feedback for which column is sorted - Informative pagination showing 'X-Y of Z entries (50 per page)' ✅ Template & View Changes: - Modified destinataer_list view in views.py - Enhanced destinataer_list.html template - Maintained all existing filtering and search functionality
This commit is contained in:
@@ -1190,11 +1190,18 @@ def destinataer_list(request):
|
||||
else:
|
||||
order_fields = fields
|
||||
destinataere = destinataere.order_by(*order_fields)
|
||||
else:
|
||||
# Default sorting by last name (nachname) ascending
|
||||
destinataere = destinataere.order_by("nachname", "vorname")
|
||||
|
||||
paginator = Paginator(destinataere, 20)
|
||||
paginator = Paginator(destinataere, 50) # Increased from 20 to 50 entries per page
|
||||
page_number = request.GET.get("page")
|
||||
page_obj = paginator.get_page(page_number)
|
||||
|
||||
# Set default sort to nachname if no sort is specified
|
||||
effective_sort = sort if sort else "nachname"
|
||||
effective_direction = direction if sort else "asc"
|
||||
|
||||
context = {
|
||||
"page_obj": page_obj,
|
||||
"search_query": search_query,
|
||||
@@ -1203,8 +1210,8 @@ def destinataer_list(request):
|
||||
"aktiv_filter": aktiv_filter,
|
||||
"familienzweig_choices": Destinataer.FAMILIENZWIG_CHOICES,
|
||||
"berufsgruppe_choices": Destinataer.BERUFSGRUPPE_CHOICES,
|
||||
"sort": sort,
|
||||
"dir": direction,
|
||||
"sort": effective_sort,
|
||||
"dir": effective_direction,
|
||||
}
|
||||
return render(request, "stiftung/destinataer_list.html", context)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user