overiding django form field label

117 views
Skip to first unread message

iceanfire

unread,
Jun 27, 2008, 11:27:46 AM6/27/08
to Google App Engine
So i've got the following model:

class Realgroups(db.Model):
name = db.StringProperty()
email = db.EmailProperty()
phone = db.PhoneNumberProperty()
address = db.PostalAddressProperty()
latlong = db.GeoPtProperty()
user = db.UserProperty()
approved = db.BooleanProperty(default=False)

and the corresponding form:

class RealgroupForm(djangoforms.ModelForm):
class Meta:
model = Realgroups
exclude = ['user','approved','latlong']

I wanted to over ride the label for the value "name" in the data store
model so I tried adding the line:

name = forms.CharField(label='Your name')

Right under "class RealgroupForm(djangoforms.ModelForm), but I get the
following error:

<type 'exceptions.AttributeError'>: 'module' object has no attribute
'CharField'
args = ("'module' object has no attribute 'CharField'",)
message = "'module' object has no attribute 'CharField'"

Do i need to import something else to make this work? Or is the code
wrong?

Here's what i'm importing right now:

from google.appengine.ext.webapp import template
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext import db
from google.appengine.ext.db import djangoforms

David Webb

unread,
Jun 27, 2008, 11:44:52 AM6/27/08
to google-a...@googlegroups.com
Use the verbose_name option when creating the Property in your Model:

http://code.google.com/appengine/docs/datastore/propertyclass.html#Property

2008/6/27 iceanfire <icea...@gmail.com>:

iceanfire

unread,
Jun 27, 2008, 12:41:02 PM6/27/08
to Google App Engine
I can't believe the solution was that simple.

Thanks alot!

On Jun 27, 10:44 am, "David Webb" <dave.w...@gmail.com> wrote:
> Use the verbose_name option when creating the Property in your Model:
>
> http://code.google.com/appengine/docs/datastore/propertyclass.html#Pr...
>
> 2008/6/27 iceanfire <iceanf...@gmail.com>:
Reply all
Reply to author
Forward
0 new messages