mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2026-09-14 11:06:13 +05:00
Some checks are pending
CodeQL / Analyze (${{ matrix.language }}) (none, python) (push) Waiting to run
Build Debian package / build (push) Waiting to run
Deploy static content to Pages / deploy (push) Waiting to run
Build Homebrew package / build (push) Waiting to run
Build GitHub Pages website / build (push) Waiting to run
Build GitHub Pages website / deploy (push) Blocked by required conditions
Run linters / lint (push) Waiting to run
Build Pip package / build (push) Waiting to run
Run tests / python_tests (ubuntu-22.04, 3.13) (push) Waiting to run
Run tests / docker_tests (push) Waiting to run
21 lines
734 B
Python
21 lines
734 B
Python
|
|
from django.views.generic import TemplateView
|
|
from django.contrib.auth.mixins import UserPassesTestMixin
|
|
from django.utils import timezone
|
|
from archivebox.api.auth import get_or_create_api_token
|
|
|
|
|
|
class JobsDashboardView(UserPassesTestMixin, TemplateView):
|
|
template_name = "jobs_dashboard.html"
|
|
|
|
|
|
def test_func(self):
|
|
return self.request.user and self.request.user.is_superuser
|
|
|
|
def get_context_data(self, **kwargs):
|
|
api_token = get_or_create_api_token(self.request.user)
|
|
context = super().get_context_data(**kwargs)
|
|
context['api_token'] = api_token.token if api_token else 'UNABLE TO GENERATE API TOKEN'
|
|
context['now'] = timezone.now().strftime("%H:%M:%S")
|
|
return context
|