Add ModelWithFieldAttributes *before* PolyModel, so that everything does not
authorTodd Larsen <tlarsen@google.com>
Fri, 26 Sep 2008 19:47:07 +0000
changeset 204 7075c27170f2
parent 203 187d45783300
child 205 4a86df751222
Add ModelWithFieldAttributes *before* PolyModel, so that everything does not become a "ModelWithFieldAttributes" in the Datastore. The way PolyModel works, each Model class hierarchy is stored in the Datastore as the class that directly inherited from PolyModel. So, we do not want to insert ModelWithFieldAttributes *after* PolyModel by inheriting *from* PolyModel, or everything would just be a ModelWithFieldAttributes in the Datastore, instead of Person, Work, Group, etc.
app/polymodel/__init__.py
--- a/app/polymodel/__init__.py	Fri Sep 26 19:35:21 2008 +0000
+++ b/app/polymodel/__init__.py	Fri Sep 26 19:47:07 2008 +0000
@@ -12,11 +12,15 @@
 
 import sys
 
+# Add ModelWithFieldAttributes *before* PolyModel, so that everything does
+# not become a "ModelWithFieldAttributes" in the Datastore.
+from soc.models import base
+
 class Error(Exception):
     """Base of all exceptions in the blixt.data module."""
     pass
 
-class PolyModel(db.Model):
+class PolyModel(base.ModelWithFieldAttributes):
     """An extension to Google App Engine models that improves the support for
     inheritance.