web/formfields.py
changeset 10903 da30851f9706
parent 10787 34ada3b21eef
child 11127 6464edfa95bb
equal deleted inserted replaced
10902:41bd01ebebb4 10903:da30851f9706
   159     :attr:`fieldset`
   159     :attr:`fieldset`
   160        optional fieldset to which this field belongs to
   160        optional fieldset to which this field belongs to
   161     :attr:`order`
   161     :attr:`order`
   162        key used by automatic forms to sort fields
   162        key used by automatic forms to sort fields
   163     :attr:`ignore_req_params`
   163     :attr:`ignore_req_params`
   164        when true, this field won't consider value potentialy specified using
   164        when true, this field won't consider value potentially specified using
   165        request's form parameters (eg you won't be able to specify a value using for
   165        request's form parameters (eg you won't be able to specify a value using for
   166        instance url like http://mywebsite.com/form?field=value)
   166        instance url like http://mywebsite.com/form?field=value)
   167 
   167 
   168     .. currentmodule:: cubicweb.web.formfields
   168     .. currentmodule:: cubicweb.web.formfields
   169 
   169 
   511         return value is None
   511         return value is None
   512 
   512 
   513 
   513 
   514 class StringField(Field):
   514 class StringField(Field):
   515     """Use this field to edit unicode string (`String` yams type). This field
   515     """Use this field to edit unicode string (`String` yams type). This field
   516     additionaly support a `max_length` attribute that specify a maximum size for
   516     additionally support a `max_length` attribute that specify a maximum size for
   517     the string (`None` meaning no limit).
   517     the string (`None` meaning no limit).
   518 
   518 
   519     Unless explicitly specified, the widget for this field will be:
   519     Unless explicitly specified, the widget for this field will be:
   520 
   520 
   521     * :class:`~cubicweb.web.formwidgets.Select` if some vocabulary is specified
   521     * :class:`~cubicweb.web.formwidgets.Select` if some vocabulary is specified
   783     :class:`~cubicweb.web.formfields.FileField` but expect that stream to
   783     :class:`~cubicweb.web.formfields.FileField` but expect that stream to
   784     actually contains some text.
   784     actually contains some text.
   785 
   785 
   786     If the stream format is one of text/plain, text/html, text/rest,
   786     If the stream format is one of text/plain, text/html, text/rest,
   787     text/markdown
   787     text/markdown
   788     then a :class:`~cubicweb.web.formwidgets.TextArea` will be additionaly
   788     then a :class:`~cubicweb.web.formwidgets.TextArea` will be additionally
   789     displayed, allowing to directly the file's content when desired, instead
   789     displayed, allowing to directly the file's content when desired, instead
   790     of choosing a file from user's file system.
   790     of choosing a file from user's file system.
   791     """
   791     """
   792     editable_formats = (
   792     editable_formats = (
   793         'text/plain', 'text/html', 'text/rest', 'text/markdown')
   793         'text/plain', 'text/html', 'text/rest', 'text/markdown')
   826         return super(EditableFileField, self)._process_form_value(form)
   826         return super(EditableFileField, self)._process_form_value(form)
   827 
   827 
   828 
   828 
   829 class BigIntField(Field):
   829 class BigIntField(Field):
   830     """Use this field to edit big integers (`BigInt` yams type). This field
   830     """Use this field to edit big integers (`BigInt` yams type). This field
   831     additionaly support `min` and `max` attributes that specify a minimum and/or
   831     additionally support `min` and `max` attributes that specify a minimum and/or
   832     maximum value for the integer (`None` meaning no boundary).
   832     maximum value for the integer (`None` meaning no boundary).
   833 
   833 
   834     Unless explicitly specified, the widget for this field will be a
   834     Unless explicitly specified, the widget for this field will be a
   835     :class:`~cubicweb.web.formwidgets.TextInput`.
   835     :class:`~cubicweb.web.formwidgets.TextInput`.
   836     """
   836     """
   910             return None
   910             return None
   911         return bool(value)
   911         return bool(value)
   912 
   912 
   913 
   913 
   914 class FloatField(IntField):
   914 class FloatField(IntField):
   915     """Use this field to edit floats (`Float` yams type). This field additionaly
   915     """Use this field to edit floats (`Float` yams type). This field additionally
   916     support `min` and `max` attributes as the
   916     support `min` and `max` attributes as the
   917     :class:`~cubicweb.web.formfields.IntField`.
   917     :class:`~cubicweb.web.formfields.IntField`.
   918 
   918 
   919     Unless explicitly specified, the widget for this field will be a
   919     Unless explicitly specified, the widget for this field will be a
   920     :class:`~cubicweb.web.formwidgets.TextInput`.
   920     :class:`~cubicweb.web.formwidgets.TextInput`.