add interface for create tokens by user for user

This commit is contained in:
Cayo Puigdefabregas 2024-09-20 14:23:14 +02:00
parent a1ffdb5ed6
commit 2f4a85f79b
2 changed files with 2 additions and 4 deletions

View File

@ -98,7 +98,6 @@ class TokenDeleteView(DashboardView, DeleteView):
model = Token model = Token
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
# self.check_valid_user()
self.pk = kwargs['pk'] self.pk = kwargs['pk']
self.object = get_object_or_404(self.model, pk=self.pk) self.object = get_object_or_404(self.model, pk=self.pk)
self.object.delete() self.object.delete()
@ -109,8 +108,7 @@ class TokenDeleteView(DashboardView, DeleteView):
class TokenNewView(DashboardView, View): class TokenNewView(DashboardView, View):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
# self.check_valid_user() Token.objects.create(token=uuid4(), owner=self.request.user)
Token.objects.create(token=uuid4())
return redirect('api:tokens') return redirect('api:tokens')

View File

@ -144,7 +144,7 @@
</ul> </ul>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link fw-bold" href="{# url 'api:tokens' #}"> <a class="nav-link fw-bold" href="{% url 'api:tokens' %}">
<i class="bi-menu-button-wide icon_sidebar"></i> <i class="bi-menu-button-wide icon_sidebar"></i>
{% trans 'Tokens' %} {% trans 'Tokens' %}
</a> </a>