#24 Ordering of places in list

This commit is contained in:
reverend 2020-09-29 21:41:36 +02:00
parent b3b8ee3104
commit a2004bd789

View File

@ -1,6 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.db.models.functions import Lower
from django.views import View from django.views import View
from django.views.generic.edit import CreateView, UpdateView, DeleteView from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.views.generic.detail import SingleObjectMixin from django.views.generic.detail import SingleObjectMixin
@ -23,7 +25,7 @@ class PlaceListView(IsAuthenticatedMixin, ListView):
paginate_by = 5 paginate_by = 5
model = Place model = Place
template_name = 'place/place_list.html' template_name = 'place/place_list.html'
ordering = ['name'] ordering = [Lower('name')]
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)