'ModelOptions' object has no attribute 'fields' error with GAE Helper

519 views
Skip to first unread message

simon101

unread,
May 12, 2009, 4:01:05 AM5/12/09
to Google App Engine
Hi guys

I have this strange error coming up on a model form. I have packaged
Django 1.0.2 myself in my application directory with appengine
helper. My code with a subset of fields looks like this:

from appengine_django.models import BaseModel
from google.appengine.ext import db
from django import forms
from django.forms import ModelForm
from django.forms import fields


class Contract(BaseModel):
TITLE_CHOICES = (
('M', 'Mr'),
('R', 'Mrs'),
('I', 'Miss'),
('S', 'Ms'),
)
forenames = db.StringProperty(verbose_name="forenames")
surname = db.StringProperty(verbose_name="surname")
title = db.StringProperty(verbose_name="title",choices=TITLE_CHOICES)

class ContractForm(ModelForm):
forenames = fields.CharField(max_length=50)
surname = fields.CharField(max_length=50)
title = fields.CharField(max_length=1)

class Meta:
model = Contract

After a lot of trial and error involving a lot of cutting and pasting
I narrowed it down to the class Meta declaration. The problem seems
to arise when a model inherits BaseModel and which then has a
modelform created from it.

Can anyone offer any clues as to how to fix this little problem.

Thanks

Simon

toh

unread,
May 13, 2009, 2:00:44 AM5/13/09
to Google App Engine
Hi,

I have seen the same error before. So I tried to reproduce it, but
unforunately, I could not see that error with your code. What does
your
views.py look like?

I saw this error while I was trying to use modelformsets with the
instruction of:

http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#id1

I could overcome this error by adding:

self.fields = []

to the __init__ method of ModelOptions class in models.py of
appengine-helper, but another similar error came up.

I tackled this one only to see another error.
(Please read above line several times.)

I finally got to know that I am not bright enough to solve this...

Probably, it is one of the limitations of the helper.

Waldemar Kornewald

unread,
May 13, 2009, 9:36:48 AM5/13/09
to Google App Engine
Hi,
for those who have the same problem, Simon cross-posted to the
appengine-python group and I replied here:
http://groups.google.com/group/google-appengine-python/browse_thread/thread/a13117221ab00251

Bye,
Waldemar Kornewald
Reply all
Reply to author
Forward
0 new messages