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