forked from mirrors/bookwyrm
black
This commit is contained in:
parent
4d6c4d3ad2
commit
da51711ddf
2 changed files with 11 additions and 3 deletions
|
@ -478,5 +478,9 @@ urlpatterns = [
|
||||||
r"^ostatus_success/?$", views.ostatus_follow_success, name="ostatus-success"
|
r"^ostatus_success/?$", views.ostatus_follow_success, name="ostatus-success"
|
||||||
),
|
),
|
||||||
# annual summary
|
# annual summary
|
||||||
re_path(r"^my-year-in-the-books/(?P<year>\d{4})/?$", views.AnnualSummary.as_view(), name="annual-summary"),
|
re_path(
|
||||||
|
r"^my-year-in-the-books/(?P<year>\d{4})/?$",
|
||||||
|
views.AnnualSummary.as_view(),
|
||||||
|
name="annual-summary",
|
||||||
|
),
|
||||||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
|
|
|
@ -22,7 +22,11 @@ def get_annual_summary_year():
|
||||||
if today >= date(today.year, 12, FIRST_DAY) and today <= date(today.year, 12, 31):
|
if today >= date(today.year, 12, FIRST_DAY) and today <= date(today.year, 12, 31):
|
||||||
return today.year
|
return today.year
|
||||||
|
|
||||||
if LAST_DAY > 0 and today >= date(today.year, 1, 1) and today <= date(today.year, 1, LAST_DAY):
|
if (
|
||||||
|
LAST_DAY > 0
|
||||||
|
and today >= date(today.year, 1, 1)
|
||||||
|
and today <= date(today.year, 1, LAST_DAY)
|
||||||
|
):
|
||||||
return today.year - 1
|
return today.year - 1
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
@ -52,7 +56,7 @@ class AnnualSummary(View):
|
||||||
|
|
||||||
paginated_years = (
|
paginated_years = (
|
||||||
int(year) - 1,
|
int(year) - 1,
|
||||||
int(year) + 1 if is_year_available(int(year) + 1) else None
|
int(year) + 1 if is_year_available(int(year) + 1) else None,
|
||||||
)
|
)
|
||||||
|
|
||||||
user = request.user
|
user = request.user
|
||||||
|
|
Loading…
Reference in a new issue