Added search bar to collection list
This commit is contained in:
parent
0bd2596ebc
commit
fb700b15d6
@ -30,9 +30,6 @@
|
||||
<th>Composer</th>
|
||||
<th class="is-hidden-mobile">Edition</th>
|
||||
{% if not collection %}<th class="is-hidden-touch">Collection</th>{% endif %}
|
||||
{% if request.is_admin %}
|
||||
<th class="is-hidden-mobile">Copies</th>
|
||||
{% endif %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -42,9 +39,6 @@
|
||||
<td title="{{ work.composer }}">{{ work.composer|truncatewords:3 }}</td>
|
||||
<td class="is-hidden-mobile" title="{{ work.edition }}">{{ work.edition|truncatewords:2 }}</td>
|
||||
{% if not collection %}<td class="is-hidden-touch">{{ work.collection.name }}</td>{% endif %}
|
||||
{% if request.is_admin %}
|
||||
<td class="is-hidden-mobile {{ work.is_available|yesno:'has-text-success,has-text-danger' }}">{{ work.available }}</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr><td colspan="4">No works found</td></tr>
|
||||
|
||||
@ -184,7 +184,7 @@ class LibraryWorkListView(WorkListView):
|
||||
return True
|
||||
|
||||
def get_works(self):
|
||||
collections = models.Collection.objects
|
||||
collections = models.Collection.objects.all()
|
||||
|
||||
if not self.request.user.is_superuser:
|
||||
collections = collections.filter(administrators=self.request.user)
|
||||
@ -204,9 +204,9 @@ class CollectionWorkListView(WorkListView):
|
||||
def get_works(self):
|
||||
works = Work.objects.filter(collection=self.kwargs['collection'])
|
||||
|
||||
if self.request.is_admin:
|
||||
loan_count = Count('project_items', Q(project_items__checkout__lte=now(), project_items__returned=None))
|
||||
works = works.annotate(loan_count=loan_count)
|
||||
#if self.request.is_admin:
|
||||
# loan_count = Count('project_items', Q(project_items__checkout__lte=now(), project_items__returned=None))
|
||||
# works = works.annotate(loan_count=loan_count)
|
||||
return works
|
||||
|
||||
def get_context_data(self, *args, **kwargs):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user