-
Notifications
You must be signed in to change notification settings - Fork 2
/
models.py
34 lines (27 loc) · 1.11 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from django.db import models
class Mount(models.Model):
name = models.CharField(max_length=20)
def __unicode__(self):
return unicode(self.name)
class Authorization(models.Model):
"""A model representing an authorization to access a specific mount"""
mount = models.ForeignKey(Mount, related_name='authorizations')
user = models.CharField(max_length=20)
password = models.CharField(max_length=20)
start = models.DateTimeField()
end = models.DateTimeField()
def __unicode__(self):
return u"%s on %s" % (self.user, self.mount)
class Listener(models.Model):
"""
A model representing a listener to a mount. Instances of this model are
only created after the listener is disconnected
"""
mount = models.ForeignKey(Mount, related_name='listeners')
user = models.CharField(max_length=20)
password = models.CharField(max_length=20)
start = models.DateTimeField()
end = models.DateTimeField()
duration = models.IntegerField()
def __unicode__(self):
return u"%s on %s for %d seconds" % (self.user, self.mount, self.duration)