The API of google.appengine.ext.db.djangoforms.ModelChoiceField is slightly
different than the vanilla django.forms.ModelChoiceField.  You may be able
to use a tool like App Engine Patch to get support for using the regular
Django form fields, but if you're going to take this route, take note of the
tips below:


On Wed, May 19, 2010 at 4:03 AM, Alex <[email protected]> wrote:

> class LibModelChoiceField(djangoforms.ModelChoiceField):

   def label_from_instance(self, obj):
>

I think you'll need to override ModelChoiceField._generate_choices to get
the behavior that you want.  Take a look at the source in the SDK.

class DimensionForm(djangoforms.ModelForm):
>    library = LibModelChoiceField(Library.all())
>

The first arg to __init__ is actually a "reference_class", not a
db.Query. Remove the ".all()" in this line. e.g.:
  library = LibModelChoiceField(Library)

-- 
Matt McDonald

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

Reply via email to