Better approach to generic list templates + other deduplication

This commit is contained in:
2020-10-08 22:54:30 +01:00
parent af7d3c4070
commit 3903481b3d
33 changed files with 252 additions and 309 deletions

View File

@@ -151,8 +151,16 @@ class SecureAPIRequest(generic.View):
class GenericListView(generic.ListView):
template_name = 'generic_list.html'
paginate_by = 20
def get_context_data(self, **kwargs):
context = super(generic.ListView, self).get_context_data(**kwargs)
context['page_title'] = self.model.__name__ + "s"
if self.request.is_ajax():
context['override'] = "base_ajax.html"
return context
def get_queryset(self):
q = self.request.GET.get('q', "")