need pointer on GeoPtProperty in app-engine/django forms
I'm not looking for a bug fix so much as an approach. I'm a newbie with a simple model:
classLocation(db.Model): name = db.StringProperty() geoPt = db.GeoPtProperty() ...
I use that to make a simple form:
class LocationForm(djangoforms.ModelForm): class Meta: model = Location
When it renders out, the GeoPt is a single text field. For this form I'd prefer latitude and longitude fields, with validation.
Which way to go? Is this a common problem with "complex objects" in开发者_StackOverflow中文版 django forms? If so, is there an accepted solution?
It is a problem with compound types and the way database-schema derived UI has to work.
You'll be much better off dropping the deadweight and running a specialized form processing library, like flatland, WTForm, FormEncode, fungiform, or indeed even a homegrown alternative.
User-input validation is not a hard problem, and it certainly doesn't always get easier by copying the database schema validation.
精彩评论