Hi Everyone, I followed the article "Django Form Validation Framework on Google App Engine"[1] and was pleasantly surprised at how easy it was. So the next step was to try it with a Model which contained a ReferenceProperty to another model.
e.g. Each Section has a Layout. SectionForm is a form for the Section model. class Layout(db.Model): name = db.StringProperty() desc = db.TestProperty() class Section(db.Model): name = db.StringProperty() layout = db.ReferenceProperty(Layout) class SectionForm(djangoforms.ModelForm): class Meta: model = Section Using the SectionForm for creating, saving and editing the Section model is great, however, the <select> box rendered isn't quite humanly readable. It works but I and especially the user doesn't know which Layout (three of them) each selection is referring to. <select name="layout" id="id_layout"> <option value="" selected="selected">---------</option> <option value="agpjaGlsdHMtb3JnchMLEg1TZWN0aW9uTGF5b3V0GAUM"><models.Layout object at 0x8d65a6c></option> <option value="agpjaGlsdHMtb3JnchMLEg1TZWN0aW9uTGF5b3V0GAYM"><models.Layout object at 0x8d658ac></option> <option value="agpjaGlsdHMtb3JnchMLEg1TZWN0aW9uTGF5b3V0GAcM"><models.Layout object at 0x8d8a9ec></option> </select> The value="" attribute is fine but I'd love it if I could actually show the Layout.name of each layout as the human readable bit (the content inside each <option> tag). e.g. <select name="layout" id="id_layout"> <option value="" selected="selected">---------</option> <option value="agpjaGlsdHMtb3JnchMLEg1TZWN0aW9uTGF5b3V0GAUM">Layout 1</option> <option value="agpjaGlsdHMtb3JnchMLEg1TZWN0aW9uTGF5b3V0GAYM">Test Layout</option> <option value="agpjaGlsdHMtb3JnchMLEg1TZWN0aW9uTGF5b3V0GAcM">Default</option> </select> Does anyone have any ideas on: 1) how to do it automatically but still using DjangoForms? 2) how to override the rendering of the form so I can do it manually? Many thanks. Cheers, Andy [1] http://code.google.com/appengine/articles/djangoforms.html -- 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 -~----------~----~----~----~------~----~------~--~---