Hi Janne,

2009/10/12 Janne Hukkinen <h...@sci.fi>:
> While learning python + django + app engine + datastore, I started by
> desiging models and used extensicely PolyModel class. It's a great way
> to abstract common fields. However, it seems that a) PolyModel is
> datastore specific and b) djangoforms therein doesn't suppor it. Am I
> correct?

I have played with DjangoForms using PolyModels recently and yes, they
are supported. It all works just as well as with normal Models.

One gotcha I did find however was that at first I couldn't figure out
how to tell Django not to output the 'class' hierarchy on the form
(since that is set inside the PolyModel base class and not by the
user). I tried to hide 'class' and '__class' but figured out it was
just one underscore '_class'. The code I used was as follows:

class MyPolyModelForm(djangoforms.ModelForm):
  class Meta:
    model = MyPolyModel
    exclude = ['_class']

Hope that helps.

Note: See this article for more information about models and forms:
http://code.google.com/appengine/articles/djangoforms.html

Cheers,
Andy

-- 
contact: Andrew Chilton
website: http://www.chilts.org/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to