Unverified Commit c61d5601 authored by Gautier D's avatar Gautier D Committed by Florent Chehab
Browse files

feat(backend): create custom admin view and register it

parent ad1f2655
import django_cas_ng.views
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic.base import RedirectView
from base_app.views import media_files_view
from base_app.admin import admin_site
from . import views
if settings.DEBUG:
......@@ -15,7 +15,7 @@ else:
urlpatterns = []
urlpatterns += [
url(r"^admin/", admin.site.urls),
url(r"^admin/", admin_site.urls),
url(r"^user/login$", django_cas_ng.views.LoginView.as_view(), name="cas_ng_login"),
r"^user/logout$", django_cas_ng.views.LogoutView.as_view(), name="cas_ng_logout"
......@@ -9,6 +9,7 @@ from backend_app.utils import clean_route
from backend_app.viewsets import ALL_VIEWSETS
from base_app.forms import UserForm
from base_app.models import User
from _cron_tasks import update_currencies, update_utc_ent, update_extra_denormalization, clear_and_clean_sessions
logger = logging.getLogger("django")
......@@ -94,3 +95,23 @@ def media_files_view(request, path):
del response["Content-Type"]
response["X-Accel-Redirect"] = "/protected-assets/media/" + path
return response
def trigger_cron(request):
Render the view that displays cron tasks
if request.method == "POST":
cron_task = request.POST.get("cron_name")
if cron_task == "update_currencies":
elif cron_task == "update_utc_ent":
elif cron_task == "update_extra_denormalization":
elif cron_task == "clear_and_clean_sessions":
return HttpResponseNotFound()
return render(request, "admin/trigger_cron.html")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment