2009-05-13 14:04:29 +00:00
|
|
|
from django.db import models
|
|
|
|
|
2011-10-13 21:34:56 +00:00
|
|
|
|
2009-05-13 14:04:29 +00:00
|
|
|
class User(models.Model):
|
|
|
|
username = models.CharField(max_length=12, unique=True)
|
|
|
|
serial = models.IntegerField()
|
|
|
|
|
2013-11-02 22:50:35 +00:00
|
|
|
|
2009-05-13 14:04:29 +00:00
|
|
|
class UserSite(models.Model):
|
2015-07-22 14:43:21 +00:00
|
|
|
user = models.ForeignKey(User, models.CASCADE, to_field="username")
|
2009-05-13 14:04:29 +00:00
|
|
|
data = models.IntegerField()
|
2009-05-15 12:44:51 +00:00
|
|
|
|
2013-11-02 22:50:35 +00:00
|
|
|
|
2014-07-08 19:58:14 +00:00
|
|
|
class UserProfile(models.Model):
|
2015-07-22 14:43:21 +00:00
|
|
|
user = models.ForeignKey(User, models.CASCADE, unique=True, to_field="username")
|
2014-07-08 19:58:14 +00:00
|
|
|
about = models.TextField()
|
|
|
|
|
|
|
|
|
|
|
|
class ProfileNetwork(models.Model):
|
2015-07-22 14:43:21 +00:00
|
|
|
profile = models.ForeignKey(UserProfile, models.CASCADE, to_field="user")
|
2014-07-08 19:58:14 +00:00
|
|
|
network = models.IntegerField()
|
|
|
|
identifier = models.IntegerField()
|
|
|
|
|
|
|
|
|
2009-05-15 12:44:51 +00:00
|
|
|
class Place(models.Model):
|
|
|
|
name = models.CharField(max_length=50)
|
|
|
|
|
2013-11-02 22:50:35 +00:00
|
|
|
|
2009-05-15 12:44:51 +00:00
|
|
|
class Restaurant(Place):
|
|
|
|
pass
|
|
|
|
|
2013-11-02 22:50:35 +00:00
|
|
|
|
2009-05-15 12:44:51 +00:00
|
|
|
class Manager(models.Model):
|
2015-07-22 14:43:21 +00:00
|
|
|
restaurant = models.ForeignKey(Restaurant, models.CASCADE)
|
2009-05-15 12:44:51 +00:00
|
|
|
name = models.CharField(max_length=50)
|
2011-01-25 04:52:54 +00:00
|
|
|
|
2013-11-02 22:50:35 +00:00
|
|
|
|
2011-01-25 04:52:54 +00:00
|
|
|
class Network(models.Model):
|
|
|
|
name = models.CharField(max_length=15)
|
|
|
|
|
2013-11-02 22:50:35 +00:00
|
|
|
|
2011-01-25 04:52:54 +00:00
|
|
|
class Host(models.Model):
|
2015-07-22 14:43:21 +00:00
|
|
|
network = models.ForeignKey(Network, models.CASCADE)
|
2011-01-25 04:52:54 +00:00
|
|
|
hostname = models.CharField(max_length=25)
|
|
|
|
|
2012-08-12 10:32:08 +00:00
|
|
|
def __str__(self):
|
2011-01-25 04:52:54 +00:00
|
|
|
return self.hostname
|