equal
deleted
inserted
replaced
4 |
4 |
5 @author: tc |
5 @author: tc |
6 ''' |
6 ''' |
7 |
7 |
8 from django.conf import settings |
8 from django.conf import settings |
9 from django.utils.decorators import method_decorator |
|
10 from django.views.generic import ListView, DetailView |
9 from django.views.generic import ListView, DetailView |
11 from p4l.forms import RecordFilterForm |
10 from p4l.forms import RecordFilterForm |
12 from p4l.models import Record |
11 from p4l.models import Record |
13 from p4l.utils import get_labels_for_uris |
12 from p4l.utils import get_labels_for_uris |
14 import json |
13 import json |
17 |
16 |
18 logger = logging.getLogger(__name__) |
17 logger = logging.getLogger(__name__) |
19 |
18 |
20 class RecordListView(ListView): |
19 class RecordListView(ListView): |
21 |
20 |
22 queryset = Record.objects.select_related("language").prefetch_related('titles').distinct() # @UndefinedVariable |
21 queryset = Record.objects.select_related("language").prefetch_related('titles', 'imprints').order_by('identifier') # @UndefinedVariable |
23 paginate_by = settings.NB_RECORDS_BY_PAGE |
22 paginate_by = settings.NB_RECORDS_BY_PAGE |
24 template_name = "p4l/p4l_home.html" |
23 template_name = "p4l/p4l_home.html" |
25 form_class = RecordFilterForm |
24 form_class = RecordFilterForm |
26 |
25 |
27 def get_context_data(self, **kwargs): |
26 def get_context_data(self, **kwargs): |
180 } |
179 } |
181 context['query_dicts'] = json.dumps(query_dicts) |
180 context['query_dicts'] = json.dumps(query_dicts) |
182 |
181 |
183 # Languages list used in drop down list |
182 # Languages list used in drop down list |
184 context['languages_list'] = json.dumps(settings.LANGUAGES_LIST) |
183 context['languages_list'] = json.dumps(settings.LANGUAGES_LIST) |
185 |
184 |
186 return context |
185 return context |
187 |
186 |
188 |
187 |