diff options
author | Parker Berberian <pberberian@iol.unh.edu> | 2019-12-19 12:39:01 -0500 |
---|---|---|
committer | Parker Berberian <pberberian@iol.unh.edu> | 2020-01-28 16:09:35 -0500 |
commit | 77377d5e9362bd35a3b300df231e82ee974675e1 (patch) | |
tree | 5e3799768eb887a0259c8c21ed61123cdde2d608 /src/booking/models.py | |
parent | 899e1a4baa95d0bc6f0eef34de66f0e257174878 (diff) |
Comments and Documentation
This change adds a ton of comments and documentation across all the code.
Change-Id: Ifee0a2f534e8584f14b0f13af4dda8dc70eb7553
Signed-off-by: Parker Berberian <pberberian@iol.unh.edu>
Diffstat (limited to 'src/booking/models.py')
-rw-r--r-- | src/booking/models.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/booking/models.py b/src/booking/models.py index 9836730..8f2446f 100644 --- a/src/booking/models.py +++ b/src/booking/models.py @@ -18,16 +18,22 @@ import resource_inventory.resource_manager class Booking(models.Model): id = models.AutoField(primary_key=True) + # All bookings are owned by the user who requested it owner = models.ForeignKey(User, on_delete=models.PROTECT, related_name='owner') + # an owner can add other users to the booking collaborators = models.ManyToManyField(User, related_name='collaborators') + # start and end time start = models.DateTimeField() end = models.DateTimeField() reset = models.BooleanField(default=False) jira_issue_id = models.IntegerField(null=True, blank=True) jira_issue_status = models.CharField(max_length=50, blank=True) purpose = models.CharField(max_length=300, blank=False) + # bookings can be extended a limited number of times ext_count = models.IntegerField(default=2) + # the hardware that the user has booked resource = models.ForeignKey(ResourceBundle, on_delete=models.SET_NULL, null=True) + # configuration for the above hardware config_bundle = models.ForeignKey(ConfigBundle, on_delete=models.SET_NULL, null=True) opnfv_config = models.ForeignKey(OPNFVConfig, on_delete=models.SET_NULL, null=True) project = models.CharField(max_length=100, default="", blank=True, null=True) @@ -41,6 +47,7 @@ class Booking(models.Model): def save(self, *args, **kwargs): """ Save the booking if self.user is authorized and there is no overlapping booking. + Raise PermissionError if the user is not authorized Raise ValueError if there is an overlapping booking """ |