Resolve issue with avatars on docs/guide page (#1349)

Related to #1307, couldn't reproduce that specific issue, but did see an
issue with the avatar sizing and styling, so added tailwind to docs
template
This commit is contained in:
daveoconnor
2024-10-09 17:28:18 -07:00
committed by GitHub
parent 68b8af9906
commit 8022c5c969
4 changed files with 26 additions and 3 deletions

View File

@@ -14,7 +14,7 @@ from allauth.socialaccount.views import SignupView as SocialSignupView
from rest_framework import generics
from rest_framework import viewsets
from rest_framework.permissions import IsAuthenticated
from rest_framework.permissions import IsAuthenticated, AllowAny
from .forms import PreferencesForm, UserProfileForm, UserProfilePhotoForm
from .models import User
@@ -279,3 +279,18 @@ class CustomEmailVerificationSentView(EmailVerificationSentView):
"EMAIL_CONFIRMATION_EXPIRE_DAYS"
] = app_settings.EMAIL_CONFIRMATION_EXPIRE_DAYS
return context
class UserAvatar(TemplateView):
"""
Returns the template for the user's avatar in the header from the htmx request.
"""
permission_classes = [AllowAny]
template_name = "users/includes/header_avatar.html"
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["user"] = self.request.user
context["mobile"] = self.request.GET.get("ui")
return context