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