Compare commits
4
Commits
0.8.4
...
375d08488d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
375d08488d | ||
|
|
f5349beaae | ||
|
|
450eda5c26 | ||
|
|
abb66f7b40 |
+5
-3
@@ -1,8 +1,10 @@
|
|||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
|
|
||||||
|
ARG VERSION=0.8.4
|
||||||
|
|
||||||
ENV TARGET=/opt/polyphonic
|
ENV TARGET=/opt/polyphonic
|
||||||
ENV RELEASE=polyphonic-0.8.4-py3-none-any.whl
|
#ENV RELEASE=polyphonic-${VERSION}-py3-none-any.whl
|
||||||
#ENV RELEASE=git+https://gitea.tfconsulting.com.au/projects/polyphonic.git
|
ENV RELEASE=git+https://gitea.tfconsulting.com.au/projects/polyphonic.git@${VERSION}
|
||||||
|
|
||||||
RUN apk add --no-cache python3 py3-pip git ghostscript sqlite
|
RUN apk add --no-cache python3 py3-pip git ghostscript sqlite
|
||||||
|
|
||||||
@@ -11,7 +13,7 @@ WORKDIR /root
|
|||||||
RUN python3 -m venv ${TARGET}
|
RUN python3 -m venv ${TARGET}
|
||||||
ENV PATH="${TARGET}/bin:$PATH"
|
ENV PATH="${TARGET}/bin:$PATH"
|
||||||
|
|
||||||
COPY dist/${RELEASE} .
|
#COPY dist/${RELEASE} .
|
||||||
RUN pip3 install ${RELEASE} --no-cache-dir
|
RUN pip3 install ${RELEASE} --no-cache-dir
|
||||||
RUN pip3 install gunicorn whitenoise
|
RUN pip3 install gunicorn whitenoise
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -1,7 +1,7 @@
|
|||||||
services:
|
services:
|
||||||
polyphonic:
|
polyphonic:
|
||||||
image: "polyphonic:0.8.4"
|
image: "polyphonic:0.8.4"
|
||||||
build: "."
|
build: .
|
||||||
ports:
|
ports:
|
||||||
- "8001:8000"
|
- "8001:8000"
|
||||||
volumes:
|
volumes:
|
||||||
@@ -12,3 +12,4 @@ services:
|
|||||||
DJANGO_SETTINGS_MODULE: local_settings
|
DJANGO_SETTINGS_MODULE: local_settings
|
||||||
PYTHONPATH: /opt/polyphonic
|
PYTHONPATH: /opt/polyphonic
|
||||||
WORK_DIR: /var/polyphonic
|
WORK_DIR: /var/polyphonic
|
||||||
|
VERSION: 0.8.4
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
<div class="has-text-centered">
|
<div class="has-text-centered">
|
||||||
<a href="?">_</a>
|
<a href="?">_</a>
|
||||||
{% for letter in letters %}
|
{% for letter in letters %}
|
||||||
<a href="?start={{ letter }}">{{ letter }}</a>
|
<a href="?start={{ letter }}&sort={{ sort }}">{{ letter }}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -38,10 +38,10 @@
|
|||||||
<table class="table is-striped is-fullwidth">
|
<table class="table is-striped is-fullwidth">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Work</th>
|
<th>Work <span class="icon-text"><a href="?start={{ start }}&sort=name">{{ "list_arrow"|icon }}</a></span></th>
|
||||||
<th>Composer</th>
|
<th>Composer <span class="icon-text"><a href="?start={{ start }}&sort=composer">{{ "list_arrow"|icon }}</a></span></th>
|
||||||
<th class="is-hidden-mobile">Edition</th>
|
<th class="is-hidden-mobile">Edition</th>
|
||||||
{% if not collection %}<th class="is-hidden-touch">Collection</th>{% endif %}
|
{% if not collection %}<th class="is-hidden-touch">Collection</th>{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|||||||
@@ -199,13 +199,8 @@ class WorkListView(CollectionMixin, TemplateView):
|
|||||||
data["meta"] = qs.meta
|
data["meta"] = qs.meta
|
||||||
# data["page_range"] = data["page_obj"]["paginator"]
|
# data["page_range"] = data["page_obj"]["paginator"]
|
||||||
else:
|
else:
|
||||||
qs = self.get_queryset()
|
qs, ctx = self.get_filtered_queryset()
|
||||||
|
data.update(ctx)
|
||||||
start = self.request.GET.get("start")
|
|
||||||
if start:
|
|
||||||
start = start.upper()
|
|
||||||
qs = qs.filter(name__gte=start, name__lt=start + "~")
|
|
||||||
data["start"] = start
|
|
||||||
|
|
||||||
data["letters"] = string.ascii_uppercase
|
data["letters"] = string.ascii_uppercase
|
||||||
|
|
||||||
@@ -222,9 +217,27 @@ class WorkListView(CollectionMixin, TemplateView):
|
|||||||
def get_collections(self):
|
def get_collections(self):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_filtered_queryset(self):
|
||||||
works = self.get_works()
|
works = self.get_works()
|
||||||
return works.order_by("name", "composer", "edition", "pk").distinct()
|
ctx = {}
|
||||||
|
|
||||||
|
sort = self.request.GET.get("sort", "name").lower()
|
||||||
|
|
||||||
|
order = ["name", "composer", "edition"]
|
||||||
|
if sort not in order:
|
||||||
|
raise KeyError(f"Cannot sort by {sort}")
|
||||||
|
order.remove(sort)
|
||||||
|
order = [sort] + order + ["pk"]
|
||||||
|
ctx["sort"] = sort
|
||||||
|
|
||||||
|
start = self.request.GET.get("start")
|
||||||
|
if start:
|
||||||
|
start = start.upper()
|
||||||
|
filters = {f"{sort}__gte": start, f"{sort}__lt": start + "~"}
|
||||||
|
works = works.filter(**filters)
|
||||||
|
ctx["start"] = start
|
||||||
|
|
||||||
|
return works.order_by(*order).distinct(), ctx
|
||||||
|
|
||||||
def get_results(self, query, page):
|
def get_results(self, query, page):
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user