kumidc/frontend/views/profile.py

28 lines
606 B
Python
Raw Normal View History

2022-08-10 06:07:17 +00:00
from django.views.generic import UpdateView
2022-08-10 07:22:40 +00:00
from django.urls import reverse_lazy
2022-08-10 06:07:17 +00:00
from core.models.profile import Profile
class ProfileUpdateView(UpdateView):
model = Profile
fields = [
"first_name",
"middle_name",
"last_name",
"nickname",
"preferred_username",
"website",
"zoneinfo",
"phone_number",
]
class OwnProfileView(ProfileUpdateView):
2022-08-10 07:18:15 +00:00
template_name = "frontend/my_profile.html"
2022-08-10 06:07:17 +00:00
def get_object(self, queryset=None):
2022-08-10 07:22:40 +00:00
return self.request.user.profile
success_url = reverse_lazy("frontend:profile")