So that you can understand the data model, I basically have cities and within each one I’ll have categories and then inside each category I’ll have listings. Here’s what I have so far.
from google.appengine.ext import db
class City(db.Model):
name = db.StringProperty(required=True)
connections = db.ListProperty()
categories = db.ListProperty()
So Next, I want to add:
class Category(db.Model)
name = db.StringProperty(required=True)
But do I need to specify that only Category should be in categories or something to that effect?
You need to throw the
categoriesproperty from yourCityand use aReferencePropertyin yourCategoryclass:This will also automatically add
categoriescollection for yourCitymodel.