From 225d3bf255fb95c1d917f0804eb0e76246d70fdc Mon Sep 17 00:00:00 2001 From: renaud gaudin Date: Fri, 8 Sep 2023 13:31:49 +0000 Subject: [PATCH] Fixed #310: referenced base image --- manager/manager/settings.py | 3 +++ manager/manager/templates/admin.html | 6 ++++++ manager/manager/views/admin.py | 8 +++++--- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/manager/manager/settings.py b/manager/manager/settings.py index d04fa6c..831d6ce 100644 --- a/manager/manager/settings.py +++ b/manager/manager/settings.py @@ -220,3 +220,6 @@ ("en", _lz("English")), ("fr", _lz("French")), ] + +BASE_IMAGE_URL = os.getenv("BASE_IMAGE_URL", "1.0.1") +BASE_IMAGE_ROOTFS_SIZE = int(os.getenv("BASE_IMAGE_ROOTFS_SIZE", "2449473536")) diff --git a/manager/manager/templates/admin.html b/manager/manager/templates/admin.html index a6e64d8..f043d41 100644 --- a/manager/manager/templates/admin.html +++ b/manager/manager/templates/admin.html @@ -3,6 +3,12 @@ {% load manager %} {% block content %} +

Base Image

+ +

{% blocktrans %}Organizations{% endblocktrans %}

{% blocktrans %}Organizations holds the configurations, orders and units.{% endblocktrans %}

{% if organizations %} diff --git a/manager/manager/views/admin.py b/manager/manager/views/admin.py index cc7e4c8..33255d3 100644 --- a/manager/manager/views/admin.py +++ b/manager/manager/views/admin.py @@ -9,6 +9,7 @@ from django.contrib import messages from django.shortcuts import render, redirect from django.utils.translation import gettext as _, gettext_lazy as _lz +from django.conf import settings from manager.decorators import staff_required from manager.models import Organization, Profile, Media @@ -125,6 +126,10 @@ def dashboard(request): "organizations": Organization.objects.all(), "profiles": Profile.objects.all(), "medias": Media.objects.all(), + "base_image": { + "url": settings.BASE_IMAGE_URL, + "rootfs_size": settings.BASE_IMAGE_ROOTFS_SIZE, + }, } forms_map = { @@ -139,7 +144,6 @@ def dashboard(request): context[key] = value(prefix=key) if request.method == "POST" and request.POST.get("form") in forms_map.keys(): - # which form is being saved? form_key = request.POST.get("form") context[form_key] = forms_map.get(form_key)(request.POST, prefix=form_key) @@ -161,7 +165,6 @@ def dashboard(request): @staff_required def toggle_account(request, username): - profile = Profile.get_or_none(username) if profile is None: raise Http404(_("Profile not found")) @@ -189,7 +192,6 @@ def toggle_account(request, username): @staff_required def delete_account(request, username): - profile = Profile.get_or_none(username) if profile is None: raise Http404(_("Profile not found"))