From 2f4a85f79bf0ac2cd74a80afcd79ed4139392de4 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Fri, 20 Sep 2024 14:23:14 +0200 Subject: [PATCH] add interface for create tokens by user for user --- api/views.py | 4 +--- dashboard/templates/base.html | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/api/views.py b/api/views.py index 5a119f9..2aeb4de 100644 --- a/api/views.py +++ b/api/views.py @@ -98,7 +98,6 @@ class TokenDeleteView(DashboardView, DeleteView): model = Token def get(self, request, *args, **kwargs): - # self.check_valid_user() self.pk = kwargs['pk'] self.object = get_object_or_404(self.model, pk=self.pk) self.object.delete() @@ -109,8 +108,7 @@ class TokenDeleteView(DashboardView, DeleteView): class TokenNewView(DashboardView, View): def get(self, request, *args, **kwargs): - # self.check_valid_user() - Token.objects.create(token=uuid4()) + Token.objects.create(token=uuid4(), owner=self.request.user) return redirect('api:tokens') diff --git a/dashboard/templates/base.html b/dashboard/templates/base.html index f4a9307..318c890 100644 --- a/dashboard/templates/base.html +++ b/dashboard/templates/base.html @@ -144,7 +144,7 @@