@@ -39,7 +39,7 @@ Creating import-export resource
39
39
-------------------------------
40
40
41
41
To integrate `django-import-export ` with ``Book `` model, we will create
42
- resource class that will describe how this resource can be imported or
42
+ a resource class that will describe how this resource can be imported or
43
43
exported.
44
44
45
45
::
@@ -56,7 +56,7 @@ exported.
56
56
Exporting data
57
57
--------------
58
58
59
- Now that we have defined resource class, we can export books::
59
+ Now that we have defined a resource class, we can export books::
60
60
61
61
>>> dataset = BookResource().export()
62
62
>>> print dataset.csv
@@ -67,12 +67,12 @@ Customize resource options
67
67
--------------------------
68
68
69
69
By default ``ModelResource `` introspects model fields and creates
70
- ``import_export.fields.Field `` attribute with appopriate widget for each
71
- field.
70
+ ``import_export.fields.Field `` attributes with an appopriate widget
71
+ for each field.
72
72
73
- To affect which model fields will be included in import-export resource,
74
- use ``fields `` option to whitelist fields or ``exclude `` option for
75
- to blacklist fields::
73
+ To affect which model fields will be included in an import-export
74
+ resource, use the ``fields `` option to whitelist fields or ``exclude ``
75
+ option to blacklist fields::
76
76
77
77
class BookResource(resources.ModelResource):
78
78
@@ -102,7 +102,7 @@ model relationships::
102
102
Declaring fields
103
103
----------------
104
104
105
- It is possible to override resource fields to change some of it's
105
+ It is possible to override a resource field to change some of it's
106
106
options::
107
107
108
108
from import_export import fields
@@ -113,7 +113,7 @@ options::
113
113
class Meta:
114
114
model = Book
115
115
116
- Other fields, that are not existing in target model may be added::
116
+ Other fields that are not existing in the target model may be added::
117
117
118
118
from import_export import fields
119
119
@@ -132,7 +132,7 @@ Other fields, that are not existing in target model may be added::
132
132
Advanced data manipulation
133
133
--------------------------
134
134
135
- Not all data can be easily pull off an object/model attribute.
135
+ Not all data can be easily extracted from an object/model attribute.
136
136
In order to turn complicated data model into a (generally simpler) processed
137
137
data structure, ``dehydrate_<fieldname> `` method should be defined::
138
138
@@ -151,12 +151,12 @@ data structure, ``dehydrate_<fieldname>`` method should be defined::
151
151
Customize widgets
152
152
-----------------
153
153
154
- ``ModelResource `` creates field with default widget for given field type.
155
- If widget should be initialized with different arguments, set `` widgets ``
156
- dict.
154
+ ``ModelResource `` creates a field with a default widget for a given field
155
+ type. If the widget should be initialized with different arguments, set the
156
+ `` widgets `` dict.
157
157
158
- In this example widget for ``published `` field is overriden to
159
- use different date format. This format will be used both for importing
158
+ In this example widget, the ``published `` field is overriden to use a
159
+ different date format. This format will be used both for importing
160
160
and exporting resource.
161
161
162
162
::
@@ -189,11 +189,11 @@ Let's import data::
189
189
False
190
190
>>> result = book_resource.import_data(dataset, dry_run=False)
191
191
192
- In 4th line we use ``modelresource_factory `` to create default
192
+ In 4th line we use ``modelresource_factory `` to create a default
193
193
``ModelResource ``. ModelResource class created this way is equal
194
194
as in :ref: `base-modelresource `.
195
195
196
- In 5th line ``Dataset `` with subset of ``Book `` fields is created.
196
+ In 5th line a ``Dataset `` with subset of ``Book `` fields is created.
197
197
198
198
In rest of code we first pretend to import data with ``dry_run `` set, then
199
199
check for any errors and import data.
@@ -227,7 +227,8 @@ Admin integration
227
227
-----------------
228
228
229
229
Admin integration is achived by subclassing
230
- ``ImportExportModelAdmin `` or one of mixins::
230
+ ``ImportExportModelAdmin `` or one of the available mixins (``ImportMixin ``,
231
+ ``ExportMixin ``, or ``ImportExportMixin ``)::
231
232
232
233
from import_export.admin import ImportExportModelAdmin
233
234
0 commit comments