1
0
mirror of https://github.com/django/django.git synced 2025-10-25 22:56:12 +00:00

magic-removal: Moved django.core.meta to django.db.models

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1631 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty
2005-12-14 05:02:51 +00:00
parent 55933c86e7
commit d0fabc0499
39 changed files with 338 additions and 331 deletions

View File

@@ -6,26 +6,26 @@ To define a one-to-one relationship, use ``OneToOneField()``.
In this example, a ``Place`` optionally can be a ``Restaurant``.
"""
from django.core import meta
from django.db import models
class Place(meta.Model):
name = meta.CharField(maxlength=50)
address = meta.CharField(maxlength=80)
class Place(models.Model):
name = models.CharField(maxlength=50)
address = models.CharField(maxlength=80)
def __repr__(self):
return "%s the place" % self.name
class Restaurant(meta.Model):
place = meta.OneToOneField(Place)
serves_hot_dogs = meta.BooleanField()
serves_pizza = meta.BooleanField()
class Restaurant(models.Model):
place = models.OneToOneField(Place)
serves_hot_dogs = models.BooleanField()
serves_pizza = models.BooleanField()
def __repr__(self):
return "%s the restaurant" % self.get_place().name
class Waiter(meta.Model):
restaurant = meta.ForeignKey(Restaurant)
name = meta.CharField(maxlength=50)
class Waiter(models.Model):
restaurant = models.ForeignKey(Restaurant)
name = models.CharField(maxlength=50)
def __repr__(self):
return "%s the waiter at %r" % (self.name, self.get_restaurant())