Merge pull request #1771 from bookwyrm-social/about-page
Refactors about page
This commit is contained in:
@ -34,7 +34,8 @@ from .books.edit_book import EditBook, ConfirmEditBook
|
||||
from .books.editions import Editions, switch_edition
|
||||
|
||||
# landing
|
||||
from .landing.landing import About, Home, Landing
|
||||
from .landing.about import about, privacy, conduct
|
||||
from .landing.landing import Home, Landing
|
||||
from .landing.login import Login, Logout
|
||||
from .landing.register import Register, ConfirmEmail, ConfirmEmailCode, resend_link
|
||||
from .landing.password import PasswordResetRequest, PasswordReset
|
||||
|
38
bookwyrm/views/landing/about.py
Normal file
38
bookwyrm/views/landing/about.py
Normal file
@ -0,0 +1,38 @@
|
||||
""" non-interactive pages """
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from django.template.response import TemplateResponse
|
||||
from django.utils import timezone
|
||||
from django.views.decorators.http import require_GET
|
||||
|
||||
from bookwyrm import models, settings
|
||||
|
||||
|
||||
@require_GET
|
||||
def about(request):
|
||||
"""more information about the instance"""
|
||||
six_months_ago = timezone.now() - relativedelta(months=6)
|
||||
six_month_count = models.User.objects.filter(
|
||||
is_active=True, local=True, last_active_date__gt=six_months_ago
|
||||
).count()
|
||||
data = {
|
||||
"active_users": six_month_count,
|
||||
"status_count": models.Status.objects.filter(
|
||||
user__local=True, deleted=False
|
||||
).count(),
|
||||
"admins": models.User.objects.filter(groups__name__in=["admin", "moderator"]),
|
||||
"version": settings.VERSION,
|
||||
}
|
||||
|
||||
return TemplateResponse(request, "about/about.html", data)
|
||||
|
||||
|
||||
@require_GET
|
||||
def conduct(request):
|
||||
"""more information about the instance"""
|
||||
return TemplateResponse(request, "about/conduct.html")
|
||||
|
||||
|
||||
@require_GET
|
||||
def privacy(request):
|
||||
"""more information about the instance"""
|
||||
return TemplateResponse(request, "about/privacy.html")
|
@ -8,14 +8,6 @@ from bookwyrm.views.feed import Feed
|
||||
|
||||
|
||||
# pylint: disable= no-self-use
|
||||
class About(View):
|
||||
"""create invites"""
|
||||
|
||||
def get(self, request):
|
||||
"""more information about the instance"""
|
||||
return TemplateResponse(request, "landing/about.html")
|
||||
|
||||
|
||||
class Home(View):
|
||||
"""landing page or home feed depending on auth"""
|
||||
|
||||
|
Reference in New Issue
Block a user