mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-18 14:16:45 +00:00
Use shelved date for display
I'm not sure if there's a better way to access this field, accessing via book.shelfbook__shelved_date in the template didn't seem to work
This commit is contained in:
parent
a16d759766
commit
eadf5cf410
2 changed files with 4 additions and 3 deletions
|
@ -103,7 +103,7 @@
|
||||||
{% include 'snippets/authors.html' %}
|
{% include 'snippets/authors.html' %}
|
||||||
</td>
|
</td>
|
||||||
<td data-title="{% trans "Shelved" %}">
|
<td data-title="{% trans "Shelved" %}">
|
||||||
{{ book.created_date|naturalday }}
|
{{ book.shelved_date|naturalday }}
|
||||||
</td>
|
</td>
|
||||||
{% latest_read_through book user as read_through %}
|
{% latest_read_through book user as read_through %}
|
||||||
<td data-title="{% trans "Started" %}">
|
<td data-title="{% trans "Started" %}">
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
from django.db import IntegrityError
|
from django.db import IntegrityError
|
||||||
from django.db.models import OuterRef, Subquery
|
from django.db.models import OuterRef, Subquery, F
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.core.paginator import Paginator
|
from django.core.paginator import Paginator
|
||||||
from django.http import HttpResponseBadRequest, HttpResponseNotFound
|
from django.http import HttpResponseBadRequest, HttpResponseNotFound
|
||||||
|
@ -69,7 +69,8 @@ class Shelf(View):
|
||||||
reviews = privacy_filter(request.user, reviews)
|
reviews = privacy_filter(request.user, reviews)
|
||||||
|
|
||||||
books = books.annotate(
|
books = books.annotate(
|
||||||
rating=Subquery(reviews.values("rating")[:1])
|
rating=Subquery(reviews.values("rating")[:1]),
|
||||||
|
shelved_date=F("shelfbook__shelved_date"),
|
||||||
).prefetch_related("authors")
|
).prefetch_related("authors")
|
||||||
|
|
||||||
paginated = Paginator(
|
paginated = Paginator(
|
||||||
|
|
Loading…
Reference in a new issue