web/views/forms.py
changeset 3396 fb261afd49cd
parent 3388 b8be8fc77c27
parent 3377 dd9d292b6a6d
child 3451 6b46d73823f5
equal deleted inserted replaced
3395:405f393bcac0 3396:fb261afd49cd
    52 
    52 
    53     * `form_renderer_id`: id of the form renderer to use to render the form
    53     * `form_renderer_id`: id of the form renderer to use to render the form
    54 
    54 
    55     * `fieldsets_in_order`: fieldset name sequence, to control order
    55     * `fieldsets_in_order`: fieldset name sequence, to control order
    56     """
    56     """
    57     id = 'base'
    57     __regid__ = 'base'
    58 
    58 
    59     is_subform = False
    59     is_subform = False
    60     internal_fields = ('__errorurl',) + NAV_FORM_PARAMETERS
    60     internal_fields = ('__errorurl',) + NAV_FORM_PARAMETERS
    61 
    61 
    62     # attributes overrideable by subclasses or through __init__
    62     # attributes overrideable by subclasses or through __init__
   289         """
   289         """
   290         return self.form_valerror and field.name in self.form_valerror.errors
   290         return self.form_valerror and field.name in self.form_valerror.errors
   291 
   291 
   292 
   292 
   293 class EntityFieldsForm(FieldsForm):
   293 class EntityFieldsForm(FieldsForm):
   294     id = 'base'
   294     __regid__ = 'base'
   295     __select__ = (match_kwargs('entity')
   295     __select__ = (match_kwargs('entity')
   296                   | (one_line_rset() & non_final_entity()))
   296                   | (one_line_rset() & non_final_entity()))
   297 
   297 
   298     internal_fields = FieldsForm.internal_fields + ('__type', 'eid', '__maineid')
   298     internal_fields = FieldsForm.internal_fields + ('__type', 'eid', '__maineid')
   299     domid = 'entityForm'
   299     domid = 'entityForm'
   555         return False
   555         return False
   556 
   556 
   557 
   557 
   558 class CompositeForm(FieldsForm):
   558 class CompositeForm(FieldsForm):
   559     """form composed of sub-forms"""
   559     """form composed of sub-forms"""
   560     id = 'composite'
   560     __regid__ = 'composite'
   561     form_renderer_id = id
   561     form_renderer_id = id
   562 
   562 
   563     def __init__(self, *args, **kwargs):
   563     def __init__(self, *args, **kwargs):
   564         super(CompositeForm, self).__init__(*args, **kwargs)
   564         super(CompositeForm, self).__init__(*args, **kwargs)
   565         self.forms = []
   565         self.forms = []
   570         self.forms.append(subform)
   570         self.forms.append(subform)
   571 
   571 
   572 
   572 
   573 class CompositeEntityForm(EntityFieldsForm):
   573 class CompositeEntityForm(EntityFieldsForm):
   574     """form composed of sub-forms"""
   574     """form composed of sub-forms"""
   575     id = 'composite'
   575     __regid__ = 'composite'
   576     form_renderer_id = id
   576     form_renderer_id = id
   577 
   577 
   578     def __init__(self, *args, **kwargs):
   578     def __init__(self, *args, **kwargs):
   579         super(CompositeEntityForm, self).__init__(*args, **kwargs)
   579         super(CompositeEntityForm, self).__init__(*args, **kwargs)
   580         self.forms = []
   580         self.forms = []