I'm not sure the best way to do this. I want to have "class Place". "Places" can be listed by either specific "City", or by a specific "Section" of a city.
list_places_by_city list_places_by_citysection Also, I want to have more than one type of place. Is subclasses the right way to do this? I tried (for "Park" as shown below), but get an error in the admin that says "'Place' object has no attribute 'has_benches'". This is what I have sketched out as a test but it doesn't work. There is the above error, and also the city sections aren't locked to the proper cities. So it allows "West Springfield" to be located in "Boston": from django.db import models # Create your models here. class City(models.Model): CITIES = ( ('Boston', 'Boston'), ('Worcester', 'Worcester'), ('Springfield', 'Springfield'), ) city_name = models.CharField(maxlength=40, choices=CITIES) def __str__(self): return self.city_name class Admin: pass class Section(models.Model): # This represents a section of the city # This isn't keeping the sections in the proper city. #Do I need unique_together? http://www.djangoproject.com/documentation/model_api/#meta-options 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 class Place(models.Model): place_name = models.CharField(maxlength=200) section = models.ForeignKey(Section) def __str__(self): return self.place_name class Admin: pass class Park(Place): has_benches = models.BooleanField() # just a test. I want certain types of places to have additional fields. 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 -~----------~----~----~----~------~----~------~--~---