Hi, I think GAE is a wonderful development environment, and the Python 
version is really empowering. However, I have decided to make my life 
easier by writing a form-generating library suitable for CMS like editing 
(admin stuff). I think Django is too big.

Requirements:
- work well with jinja2, but not assume jinja2
- work well with the ndb modelling
- possible to extend the library to allow dynamic online creation of forms
- allow multiple ndb objects in a form
- allow multipe objects of the same class in a form
- allow partial updates of objects (only touch some fields)
- return the form content untouched to the browser when validators fail, 
but indicating the field errors
- efficient instancing/generating/handling of forms

More suggestions?

My experience with GAE is somewhat limited so I am not quite sure how to 
best represent this in Python. 

I am thinking usage along these lines (pseudocode) for GET:

form = Form(
  objs={'SITE':model.SiteInfoDbModel,'USR1':model.UserDbModel,'USR2':model.
UserDbModel},
)

form.set_template(
  (Form.GROUP, # generates a DIV or other grouping mechanism
    (form.SITE.sitename, 40), # allow editing of sitename string 40 chars 
line
    (form.USR1.fullname, 50), # 50 chars line
    (form.USR1.description, 50,15) # generate multi line editing
    (Form.READONLY,'edited by',form.USR2.username)
  )
)

form.attach_db_objects(fetch_siteinfo(),fetch_admin(),fetch_currentuser())

self.response.out.write(template.render(form=form))


and something like this for POST:

form.attach_db_objects(fetch_siteinfo(),fetch_admin(),fetch_currentuser())

try:
  form.set_from_request(self.request)
  form.validate_and_commit()
  self.response.out.write(template.render(form=form,message='Data Stored'))
except ValidationError: 
  self.response.out.write(template.render(form=form,message='Validation 
failed, not stored'))

It might be better to use classes rather than lists for the form template.

Comments?

Ola.












-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/ioOwq7yGu8wJ.
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.

Reply via email to