2009-05-13 16:04:29 +02:00
|
|
|
from django.db import models
|
2012-08-12 12:32:08 +02:00
|
|
|
from django.utils.encoding import python_2_unicode_compatible
|
2009-05-13 16:04:29 +02:00
|
|
|
|
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):
|
|
|
|
user = models.ForeignKey(User, to_field="username")
|
|
|
|
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):
|
|
|
|
user = models.ForeignKey(User, unique=True, to_field="username")
|
|
|
|
about = models.TextField()
|
|
|
|
|
|
|
|
|
|
|
|
class ProfileNetwork(models.Model):
|
|
|
|
profile = models.ForeignKey(UserProfile, to_field="user")
|
|
|
|
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):
|
2014-05-29 02:39:14 +02:00
|
|
|
restaurant = models.ForeignKey(Restaurant)
|
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
|
|
|
|
2012-08-12 12:32:08 +02:00
|
|
|
@python_2_unicode_compatible
|
2011-01-25 05:52:54 +01:00
|
|
|
class Host(models.Model):
|
|
|
|
network = models.ForeignKey(Network)
|
|
|
|
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
|