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' %}
|
||||
</td>
|
||||
<td data-title="{% trans "Shelved" %}">
|
||||
{{ book.created_date|naturalday }}
|
||||
{{ book.shelved_date|naturalday }}
|
||||
</td>
|
||||
{% latest_read_through book user as read_through %}
|
||||
<td data-title="{% trans "Started" %}">
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
from collections import namedtuple
|
||||
|
||||
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.core.paginator import Paginator
|
||||
from django.http import HttpResponseBadRequest, HttpResponseNotFound
|
||||
|
@ -69,7 +69,8 @@ class Shelf(View):
|
|||
reviews = privacy_filter(request.user, reviews)
|
||||
|
||||
books = books.annotate(
|
||||
rating=Subquery(reviews.values("rating")[:1])
|
||||
rating=Subquery(reviews.values("rating")[:1]),
|
||||
shelved_date=F("shelfbook__shelved_date"),
|
||||
).prefetch_related("authors")
|
||||
|
||||
paginated = Paginator(
|
||||
|
|
Loading…
Reference in a new issue