class DisplayForm(Form): mode = FORM_DISPLAY def form_params(self): return self.params FORM_VIEW = 'form-view' FORM_ACTIONS = 'form-actions' FORM_WIDGET = 'form-widget' FORM_DISPLAY_WIDGET = 'form-display-widget' ptah.register_snippet(FORM_VIEW, Form, renderer='ptah.form:templates/form.pt') ptah.register_snippet(FORM_VIEW, DisplayForm, renderer='ptah.form:templates/form-display.pt') ptah.register_snippet(FORM_ACTIONS, Form, renderer='ptah.form:templates/form-actions.pt') ptah.register_snippet(FORM_WIDGET, Field, renderer='ptah.form:templates/widget.pt') ptah.register_snippet(FORM_DISPLAY_WIDGET, Field,
class DisplayForm(Form): mode = FORM_DISPLAY def form_params(self): return self.params FORM_VIEW = 'form-view' FORM_ACTIONS = 'form-actions' FORM_WIDGET = 'form-widget' FORM_DISPLAY_WIDGET = 'form-display-widget' ptah.register_snippet( FORM_VIEW, Form, renderer='ptah.form:templates/form.pt') ptah.register_snippet( FORM_VIEW, DisplayForm, renderer='ptah.form:templates/form-display.pt') ptah.register_snippet( FORM_ACTIONS, Form, renderer='ptah.form:templates/form-actions.pt') ptah.register_snippet( FORM_WIDGET, Field, renderer='ptah.form:templates/widget.pt') ptah.register_snippet(
content = self.create(**data) self.message('New content has been created.') return HTTPFound(location=self.get_next_url(content)) @form.button('Cancel') def cancel_handler(self): return HTTPFound(location='.') def get_next_url(self, content): return self.request.resource_url(content) ptah.register_snippet('form-actions', AddForm, renderer='ptah.cms:form-actions.pt') class EditForm(form.Form): @reify def label(self): return 'Modify content: %s' % self.tinfo.title @reify def fields(self): return self.tinfo.fieldset def form_content(self): data = {} for name, field in self.tinfo.fieldset.items():
return content = self.create(**data) self.message('New content has been created.') return HTTPFound(location=self.get_next_url(content)) @form.button('Cancel') def cancel_handler(self): return HTTPFound(location='.') def get_next_url(self, content): return self.request.resource_url(content) ptah.register_snippet( 'form-actions', AddForm, renderer='ptah.cms:form-actions.pt') class EditForm(form.Form): @reify def label(self): return 'Modify content: %s'%self.tinfo.title @reify def fields(self): return self.tinfo.fieldset def form_content(self): data = {} for name, field in self.tinfo.fieldset.items():