Set order_by on AddressListView
Avoid pagination inconsistency
This commit is contained in:
parent
d7e8a411cd
commit
76c18c0cae
|
@ -27,7 +27,7 @@ urlpatterns = [
|
||||||
path('bills/<int:pk>/download/', views.BillDownloadView.as_view(), name='bill-download'),
|
path('bills/<int:pk>/download/', views.BillDownloadView.as_view(), name='bill-download'),
|
||||||
path('profile/', views.ProfileView.as_view(), name='profile'),
|
path('profile/', views.ProfileView.as_view(), name='profile'),
|
||||||
path('profile/setLang/<code>', views.profile_set_language, name='profile-set-lang'),
|
path('profile/setLang/<code>', views.profile_set_language, name='profile-set-lang'),
|
||||||
path('address/', views.MailView.as_view(), name='address-list'),
|
path('address/', views.AddressListView.as_view(), name='address-list'),
|
||||||
path('address/new/', views.MailCreateView.as_view(), name='address-create'),
|
path('address/new/', views.MailCreateView.as_view(), name='address-create'),
|
||||||
path('address/<int:pk>/', views.MailUpdateView.as_view(), name='address-update'),
|
path('address/<int:pk>/', views.MailUpdateView.as_view(), name='address-update'),
|
||||||
path('address/<int:pk>/delete/', views.AddressDeleteView.as_view(), name='address-delete'),
|
path('address/<int:pk>/delete/', views.AddressDeleteView.as_view(), name='address-delete'),
|
||||||
|
|
|
@ -240,7 +240,7 @@ class BillDownloadView(CustomContextMixin, UserTokenRequiredMixin, View):
|
||||||
return HttpResponse(bill.html or bill.render())
|
return HttpResponse(bill.html or bill.render())
|
||||||
|
|
||||||
|
|
||||||
class MailView(ServiceListView):
|
class AddressListView(ServiceListView):
|
||||||
service_class = AddressService
|
service_class = AddressService
|
||||||
model = Address
|
model = Address
|
||||||
template_name = "musician/addresses.html"
|
template_name = "musician/addresses.html"
|
||||||
|
@ -249,6 +249,11 @@ class MailView(ServiceListView):
|
||||||
'title': _('Mail addresses'),
|
'title': _('Mail addresses'),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
qs = super().get_queryset()
|
||||||
|
qs = qs.order_by("domain", "name")
|
||||||
|
return qs
|
||||||
|
|
||||||
def get_queryfilter(self):
|
def get_queryfilter(self):
|
||||||
"""Retrieve query params (if any) to filter queryset"""
|
"""Retrieve query params (if any) to filter queryset"""
|
||||||
domain_id = self.request.GET.get('domain')
|
domain_id = self.request.GET.get('domain')
|
||||||
|
|
Loading…
Reference in New Issue