Fix Gravatar profiles showing on hover and add gravatar explanation and profile page for users
This commit is contained in:
parent
2451a6c630
commit
4c0db9f842
7 changed files with 79 additions and 10 deletions
|
|
@ -47,6 +47,17 @@ def gravatar(email, size=20):
|
|||
html = f'<img src="{url}" width="{size}" height="{size}" alt="Gravatar">'
|
||||
return mark_safe(html)
|
||||
|
||||
@register.filter
|
||||
def gravatar_no_hover(email, size=20):
|
||||
"""
|
||||
Returns an HTML image tag for the Gravatar of a given email,
|
||||
with the specified width and height.
|
||||
"""
|
||||
url = gravatar_url(email, size)
|
||||
# Return a safe HTML snippet with the image element
|
||||
html = f'<img src="{url}" width="{size}" height="{size}" alt="Gravatar" class="ignore">'
|
||||
return mark_safe(html)
|
||||
|
||||
@register.filter
|
||||
def gravatar_profile_data(email):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ from .views import (
|
|||
ChangeDefaultFriendCodeView,
|
||||
EditFriendCodeView,
|
||||
SettingsView,
|
||||
ProfileView,
|
||||
)
|
||||
|
||||
urlpatterns = [
|
||||
|
|
@ -16,4 +17,5 @@ urlpatterns = [
|
|||
path("friend-codes/delete/<int:pk>/", DeleteFriendCodeView.as_view(), name="delete_friend_code"),
|
||||
path("friend-codes/default/<int:pk>/", ChangeDefaultFriendCodeView.as_view(), name="change_default_friend_code"),
|
||||
path("settings/", SettingsView.as_view(), name="settings"),
|
||||
path("profile/", ProfileView.as_view(), name="profile"),
|
||||
]
|
||||
|
|
@ -129,6 +129,12 @@ class SettingsView(LoginRequiredMixin, TemplateView):
|
|||
"""
|
||||
template_name = "account/settings.html"
|
||||
|
||||
class ProfileView(LoginRequiredMixin, TemplateView):
|
||||
"""
|
||||
Display the user's profile.
|
||||
"""
|
||||
template_name = "account/profile.html"
|
||||
|
||||
class EditFriendCodeView(LoginRequiredMixin, UpdateView):
|
||||
"""
|
||||
Edit the in-game name for a friend code.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue