mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-12 22:25:44 -04:00
merge queues and actors apps into new workers app
This commit is contained in:
parent
e50f8cb3b6
commit
e469c5a344
37 changed files with 89 additions and 304 deletions
20
archivebox/workers/views.py
Normal file
20
archivebox/workers/views.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
|
||||
from django.views.generic import TemplateView
|
||||
from django.contrib.auth.mixins import UserPassesTestMixin
|
||||
from django.utils import timezone
|
||||
from 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
|
Loading…
Add table
Add a link
Reference in a new issue