Thanks for your reply.  I'm trying what you said but I can't get it to
work.  If I put class "City" first, "Place" doesn't work, and if I put
another class first, other classes get errors.  Not sure what is wrong
with the order.

from django.db import models

class City(models.Model):
    CITIES = (
        ('Boston', 'Boston'),
        ('Worcester', 'Worcester'),
        ('Springfield', 'Springfield'),
    )
    city_name = models.CharField(maxlength=40, choices=CITIES)
    place = models.OneToOneField(Place)

    def __str__(self):
        return self.city_name

    class Admin:
        pass

class Place(models.Model):
    place_name = models.CharField(maxlength=200)
    CitySection = models.ForeignKey(CitySection)

    def __str__(self):
        return self.place_name

    class Admin:
        pass

class Park(models.Model):
    has_benches = models.BooleanField() # just a test
    place = models.OneToOneField(Place)

    class Admin:
        pass

class CitySection(models.Model):
    SECTIONS = (
        ('West Boston', 'West Boston'),
        ('South Boston', 'South Boston'),
        ('West Springfield', 'West Springfield'),
        ('Central Worcester', 'Central Worcester'),
        ('South Worcester', 'South Worcester'),
    )
    city_section = models.CharField(maxlength=5, choices=SECTIONS)
    city = models.ForeignKey(City)

    def __str__(self):
        return self.city_section

    class Admin:
        pass


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to