From bfa45ae7b3848960e17ab0505fdd768577ba1bb7 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Fri, 22 Dec 2023 12:47:32 +0500 Subject: [PATCH] default package --- websiteFunctions/website.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index 916c41cfd..ae12287bb 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -6654,6 +6654,24 @@ def AssignPackage(self, request=None, userID=None, data=None, DeleteID=None): def CreateDockersite(self, request=None, userID=None, data=None): adminNames = ACLManager.loadAllUsers(userID) Data = {'adminNames': adminNames} + + + if PackageAssignment.objects.all().count() == 0: + + name = 'Default' + cpu = 1 + Memory = 1024 + Bandwidth = '100' + disk = '100' + + saveobj = DockerPackages(Name=name, CPUs=cpu, Ram=Memory, Bandwidth=Bandwidth, DiskSpace=disk, config='') + saveobj.save() + + userobj = Administrator.objects.get(pk=1) + + sv = PackageAssignment(user=userobj, package=saveobj) + sv.save() + proc = httpProc(request, 'websiteFunctions/CreateDockerSite.html', Data, 'createWebsite') return proc.render()