mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-27 15:27:05 -05:00
feat: Introduce lists and reviews apps, refactor user list functionality from accounts, and add user profile fields.
This commit is contained in:
@@ -20,10 +20,10 @@ from django.core.files.uploadedfile import UploadedFile
|
||||
from apps.accounts.models import (
|
||||
User,
|
||||
PasswordReset,
|
||||
TopList,
|
||||
EmailVerification,
|
||||
UserProfile,
|
||||
)
|
||||
from apps.lists.models import UserList
|
||||
from django_forwardemail.services import EmailService
|
||||
from apps.parks.models import ParkReview
|
||||
from apps.rides.models import RideReview
|
||||
@@ -208,9 +208,9 @@ class ProfileView(DetailView):
|
||||
.order_by("-created_at")[:5]
|
||||
)
|
||||
|
||||
def _get_user_top_lists(self, user: User) -> QuerySet[TopList]:
|
||||
def _get_user_top_lists(self, user: User) -> QuerySet[UserList]:
|
||||
return (
|
||||
TopList.objects.filter(user=user)
|
||||
UserList.objects.filter(user=user)
|
||||
.select_related("user", "user__profile")
|
||||
.prefetch_related("items")
|
||||
.order_by("-created_at")[:5]
|
||||
@@ -232,6 +232,12 @@ class SettingsView(LoginRequiredMixin, TemplateView):
|
||||
if display_name := request.POST.get("display_name"):
|
||||
profile.display_name = display_name
|
||||
|
||||
if unit_system := request.POST.get("unit_system"):
|
||||
profile.unit_system = unit_system
|
||||
|
||||
if location := request.POST.get("location"):
|
||||
profile.location = location
|
||||
|
||||
if "avatar" in request.FILES:
|
||||
avatar_file = cast(UploadedFile, request.FILES["avatar"])
|
||||
profile.avatar.save(avatar_file.name, avatar_file, save=False)
|
||||
|
||||
Reference in New Issue
Block a user