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 |