Remove inheritance from PolyModel in Answer and Linkable model. Replace PolyModel inheritance with base.ModelWithFieldAttributes.
A little explanation why we are trying to get rid of PolyModel. We decided to use PolyModel in order to get support for model inheritance in App Engine, however as we know this was a hacky workaround which added inheritance_line property to each model. Recent commits which added Linkable model caused our data viewer in admin console to show only one model "Linkable" since all of the classes inherited from it. Basically datastore viewer was useless plus we had a really big mess in datastore since everything was of one kind (Linkable). It's almost like creating one huge table in SQL database. Upcoming commits will eliminate all usage of PolyModel and finally remove PolyModel from our repository. We are still using inheritance however this doesn't modify how models are saved in data store so basically it's like copy and paste of properties from parent models.
Patch by: Pawel Solyga, Sverre Rabbelier
--- a/app/soc/models/answer.py Sat Nov 22 22:30:32 2008 +0000
+++ b/app/soc/models/answer.py Sat Nov 22 22:44:02 2008 +0000
@@ -22,16 +22,16 @@
]
-import polymodel
-
from google.appengine.ext import db
import soc.models.question
import soc.models.quiz
import soc.models.response
+from soc.models import base
-class Answer(polymodel.PolyModel):
+
+class Answer(base.ModelWithFieldAttributes):
"""Model of a specific Answer to a Question in a specific Response.
The properties in this Model do not have verbose_name or help_text,
--- a/app/soc/models/linkable.py Sat Nov 22 22:30:32 2008 +0000
+++ b/app/soc/models/linkable.py Sat Nov 22 22:44:02 2008 +0000
@@ -23,12 +23,12 @@
import re
-import polymodel
-
from google.appengine.ext import db
from django.utils.translation import ugettext_lazy
+from soc.models import base
+
# start with ASCII digit or lowercase
# (additional ASCII digit or lowercase
@@ -66,7 +66,7 @@
PATH_LINK_ID_REGEX = re.compile(PATH_LINK_ID_PATTERN)
-class Linkable(polymodel.PolyModel):
+class Linkable(base.ModelWithFieldAttributes):
"""A base class for Model classes that are "linkable".
Many entities in Melange are identified by a "link path" that is formed