1 ##############################################################################
2 # Copyright (c) 2020 Sean Smith and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
10 from django.db import models
11 from account.models import Lab
14 class ActiveVPNUser(models.Model):
15 """ Keeps track of how many VPN Users are connected to Lab """
16 time_stamp = models.DateTimeField(auto_now_add=True)
17 lab = models.ForeignKey(Lab, on_delete=models.CASCADE, null=False)
18 active_users = models.IntegerField()
21 def create(cls, lab_name, active_users):
23 This creates an Active VPN Users entry from
24 from lab_name as a string
27 lab = Lab.objects.get(name=lab_name)
28 avu = cls(lab=lab, active_users=active_users)