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