Add profile edit view

This commit is contained in:
Kumi 2022-08-10 06:07:17 +00:00
parent d9e34c574a
commit 0d6555abe2
Signed by: kumi
GPG key ID: ECBCC9082395383F
3 changed files with 27 additions and 2 deletions

View file

@ -1,4 +1,4 @@
# Generated by Django 3.2.15 on 2022-08-05 07:28 # Generated by Django 3.2.15 on 2022-08-10 06:05
from django.conf import settings from django.conf import settings
from django.db import migrations, models from django.db import migrations, models
@ -8,7 +8,7 @@ import django.db.models.deletion
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('oidc_provider', '0027_auto_20220801_1333'), ('oidc_provider', '0027_auto_20220810_0605'),
('core', '0005_profile_last_name'), ('core', '0005_profile_last_name'),
] ]

View file

@ -7,11 +7,13 @@ from .views.log import AuthorizationLogView
from .views.datatables.log import AuthorizationLogDataView from .views.datatables.log import AuthorizationLogDataView
from .views.clients import ClientView, ClientEditView from .views.clients import ClientView, ClientEditView
from .views.datatables.clients import ClientDataView from .views.datatables.clients import ClientDataView
from .views.profile import OwnProfileView
urlpatterns = [ urlpatterns = [
path("", IndexView.as_view()), path("", IndexView.as_view()),
path("dashboard/", DashboardView.as_view(), name="dashboard"), path("dashboard/", DashboardView.as_view(), name="dashboard"),
path("profile/", OwnProfileView.as_view(), name="profile"),
path("profile/change_password/", PasswordChangeView.as_view(), name="change_password"), path("profile/change_password/", PasswordChangeView.as_view(), name="change_password"),
path("profile/totp/", TOTPDispatcherView.as_view(), name="totp"), path("profile/totp/", TOTPDispatcherView.as_view(), name="totp"),
path("profile/totp/activate/", TOTPActivationView.as_view(), name="activate_totp"), path("profile/totp/activate/", TOTPActivationView.as_view(), name="activate_totp"),

23
frontend/views/profile.py Normal file
View file

@ -0,0 +1,23 @@
from django.views.generic import UpdateView
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):
def get_object(self, queryset=None):
return self.request.user.profile