def get_context_data(self, **kwargs):
context = super(DetailView, self).get_context_data(**kwargs)
context['user'] = self.request.user
context['users'] = User.objects.all()
# Send list of keys to front end if the request came from the admin
if self.request.user.is_superuser:
keys = InviteKey.objects.all()
context['keys'] = keys
return context
# Use Django's built in login system but redirect to the homepage if already
# logged in
评论列表
文章目录