web/form.py
branchtls-sprint
changeset 874 90d98d80af82
parent 869 168ad6d424d1
child 887 51e371245bc5
equal deleted inserted replaced
873:3d9df99b0bfa 874:90d98d80af82
   405         return unicode(value)
   405         return unicode(value)
   406 
   406 
   407     def render(self, form):
   407     def render(self, form):
   408         return self.widget.render(form, self)
   408         return self.widget.render(form, self)
   409 
   409 
   410 
       
   411 class StringField(Field):
   410 class StringField(Field):
   412     def __init__(self, max_length=None, **kwargs):
   411     def __init__(self, max_length=None, **kwargs):
   413         super(StringField, self).__init__(**kwargs)
   412         super(StringField, self).__init__(**kwargs)
   414         self.max_length = max_length
   413         self.max_length = max_length
   415         
   414         
   588         self.entity = kwargs.pop('entity', None)
   587         self.entity = kwargs.pop('entity', None)
   589         super(EntityFieldsForm, self).__init__(*args, **kwargs)
   588         super(EntityFieldsForm, self).__init__(*args, **kwargs)
   590         self.form_add_hidden('__type')
   589         self.form_add_hidden('__type')
   591         self.form_add_hidden('eid', eidparam=False)
   590         self.form_add_hidden('eid', eidparam=False)
   592         
   591         
   593     def form_render(self, entity, **values):
   592     def form_render(self, **values):
   594         self.form_add_entity_hiddens(entity.e_schema)
   593         self.form_add_entity_hiddens(self.entity.e_schema)
   595         self.entity = entity
       
   596         return super(EntityFieldsForm, self).form_render(**values)
   594         return super(EntityFieldsForm, self).form_render(**values)
   597 
   595 
   598     def form_add_entity_hiddens(self, eschema):
   596     def form_add_entity_hiddens(self, eschema):
   599         for field in self.fields[:]:
   597         for field in self.fields[:]:
   600             fieldname = field.name
   598             fieldname = field.name