2012-06-08 00:08:47 +08:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
2006-06-20 13:29:19 +08:00
|
|
|
from django.db import models
|
2012-08-12 18:32:08 +08:00
|
|
|
from django.utils.encoding import python_2_unicode_compatible
|
2006-06-20 13:29:19 +08:00
|
|
|
|
2011-10-14 05:34:56 +08:00
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
@python_2_unicode_compatible
|
2006-06-20 13:29:19 +08:00
|
|
|
class Place(models.Model):
|
2007-08-05 13:14:46 +08:00
|
|
|
name = models.CharField(max_length=50)
|
|
|
|
address = models.CharField(max_length=80)
|
2006-06-20 13:29:19 +08:00
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
def __str__(self):
|
2012-06-08 00:08:47 +08:00
|
|
|
return "%s the place" % self.name
|
2006-06-20 13:29:19 +08:00
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
@python_2_unicode_compatible
|
2006-06-20 13:29:19 +08:00
|
|
|
class Restaurant(models.Model):
|
|
|
|
place = models.OneToOneField(Place)
|
2013-08-12 04:19:09 +08:00
|
|
|
serves_hot_dogs = models.BooleanField(default=False)
|
|
|
|
serves_pizza = models.BooleanField(default=False)
|
2006-06-20 13:29:19 +08:00
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
def __str__(self):
|
2012-06-08 00:08:47 +08:00
|
|
|
return "%s the restaurant" % self.place.name
|
2006-06-20 13:29:19 +08:00
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
@python_2_unicode_compatible
|
2008-05-29 20:17:03 +08:00
|
|
|
class Bar(models.Model):
|
|
|
|
place = models.OneToOneField(Place)
|
2013-03-24 22:27:27 +08:00
|
|
|
serves_cocktails = models.BooleanField(default=True)
|
2008-05-29 20:17:03 +08:00
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
def __str__(self):
|
2012-06-08 00:08:47 +08:00
|
|
|
return "%s the bar" % self.place.name
|
2008-05-29 20:17:03 +08:00
|
|
|
|
2008-08-02 07:16:59 +08:00
|
|
|
class UndergroundBar(models.Model):
|
|
|
|
place = models.OneToOneField(Place, null=True)
|
2013-03-24 22:27:27 +08:00
|
|
|
serves_cocktails = models.BooleanField(default=True)
|
2008-08-02 07:16:59 +08:00
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
@python_2_unicode_compatible
|
2006-06-20 13:29:19 +08:00
|
|
|
class Favorites(models.Model):
|
2007-08-05 13:14:46 +08:00
|
|
|
name = models.CharField(max_length = 50)
|
2006-06-20 13:29:19 +08:00
|
|
|
restaurants = models.ManyToManyField(Restaurant)
|
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
def __str__(self):
|
2012-06-08 00:08:47 +08:00
|
|
|
return "Favorites for %s" % self.name
|
2006-06-20 13:29:19 +08:00
|
|
|
|
2009-03-06 10:02:09 +08:00
|
|
|
class Target(models.Model):
|
|
|
|
pass
|
|
|
|
|
|
|
|
class Pointer(models.Model):
|
|
|
|
other = models.OneToOneField(Target, primary_key=True)
|
|
|
|
|
|
|
|
class Pointer2(models.Model):
|
|
|
|
other = models.OneToOneField(Target)
|