This commit is contained in:
Xavier Fiechter 2023-02-04 18:58:27 +01:00
parent cdc23acb6a
commit de318e7e18
2 changed files with 11 additions and 1 deletions

View file

@ -8,5 +8,8 @@
<h2 style="padding-top: 1em;">Profile</h2>
<h3>API Key</h3>
<p>
<tt>{{ api_token }}</tt>
</p>
{% endblock %}

View file

@ -1,5 +1,12 @@
from django.shortcuts import render
from django.views.generic import TemplateView # FormView,
from rest_framework.authtoken.models import Token
class ProfileView(TemplateView):
""" """
template_name = 'profile.html'
def get_context_data(self, **kwargs):
context = super(ProfileView, self).get_context_data(**kwargs)
context['api_token'] = Token.objects.get(user_id=self.request.user.id)
return context