Skip to content

Commit

Permalink
default package
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Dec 22, 2023
1 parent a0be5c3 commit bfa45ae
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions websiteFunctions/website.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit bfa45ae

Please sign in to comment.