diff --git a/core/migrations/0006_authorizationlog.py b/core/migrations/0006_authorizationlog.py index 51c2573..0a3dfe0 100644 --- a/core/migrations/0006_authorizationlog.py +++ b/core/migrations/0006_authorizationlog.py @@ -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.db import migrations, models @@ -8,7 +8,7 @@ import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ - ('oidc_provider', '0027_auto_20220801_1333'), + ('oidc_provider', '0027_auto_20220810_0605'), ('core', '0005_profile_last_name'), ] diff --git a/frontend/urls.py b/frontend/urls.py index 68c5adb..2283f72 100644 --- a/frontend/urls.py +++ b/frontend/urls.py @@ -7,11 +7,13 @@ from .views.log import AuthorizationLogView from .views.datatables.log import AuthorizationLogDataView from .views.clients import ClientView, ClientEditView from .views.datatables.clients import ClientDataView +from .views.profile import OwnProfileView urlpatterns = [ path("", IndexView.as_view()), 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/totp/", TOTPDispatcherView.as_view(), name="totp"), path("profile/totp/activate/", TOTPActivationView.as_view(), name="activate_totp"), diff --git a/frontend/views/profile.py b/frontend/views/profile.py new file mode 100644 index 0000000..6de13fe --- /dev/null +++ b/frontend/views/profile.py @@ -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 \ No newline at end of file