Fields¶
-
class
import_export.fields.
Field
(attribute=None, column_name=None, widget=None, default=<class django.db.models.fields.NOT_PROVIDED>, readonly=False, saves_null_values=True)¶ Field represent mapping between object field and representation of this field.
Parameters: - attribute – A string of either an instance attribute or callable off the object.
- column_name – Lets you provide a name for the column that represents this field in the export.
- widget – Defines a widget that will be used to represent this field’s data in the export.
- readonly – A Boolean which defines if this field will be ignored during import.
- default – This value will be returned by
clean()
if this field’s widget did not return an adequate value. - saves_null_values – Controls whether null values are saved on the object
-
clean
(data)¶ Translates the value stored in the imported datasource to an appropriate Python object and returns it.
-
export
(obj)¶ Returns value from the provided object converted to export representation.
-
get_value
(obj)¶ Returns the value of the object’s attribute.