From a2004bd789c6109b3598b5c2eefcc8b05c11c393 Mon Sep 17 00:00:00 2001 From: reverend Date: Tue, 29 Sep 2020 21:41:36 +0200 Subject: [PATCH] #24 Ordering of places in list --- django_lostplaces/lostplaces/views/place_views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/django_lostplaces/lostplaces/views/place_views.py b/django_lostplaces/lostplaces/views/place_views.py index 3240e10..f367623 100644 --- a/django_lostplaces/lostplaces/views/place_views.py +++ b/django_lostplaces/lostplaces/views/place_views.py @@ -1,6 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +from django.db.models.functions import Lower + from django.views import View from django.views.generic.edit import CreateView, UpdateView, DeleteView from django.views.generic.detail import SingleObjectMixin @@ -23,7 +25,7 @@ class PlaceListView(IsAuthenticatedMixin, ListView): paginate_by = 5 model = Place template_name = 'place/place_list.html' - ordering = ['name'] + ordering = [Lower('name')] def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs)