@@ -127,6 +127,10 @@ into the following data models:
127127.. note::
128128 Except the added "slug" field, **Question** and **Choice** are copied from Django tutorial part 1.
129129
130+ .. note::
131+ Please also pay attention to 'choice' sheet. There exists an arbitrary column: "Noise", which
132+ exists to show case skipping column feature using mapdicts later.
133+
130134Please visit this link http://localhost:8000/polls/import/, you shall see this upload form:
131135
132136.. image:: import-page.png
@@ -168,15 +172,17 @@ The star is :meth:`~django_excel.save_book_to_database`. The parameter **models*
168172should be a list of django models. **initializers** is a list of initialization
169173functions for each model. In the example, we do not have init function for Question
170174so 'None' is given and `choice_func` is given to Choice. **mapdicts** is a list of
171- column names for each model. The member of the **mapdicts** can be a dictionary
172- as well::
175+ column names for each model and the member of the **mapdicts** can be a dictionary::
173176
174177 {
175178 "Question Text": "question_text",
176179 "Publish Date": "pub_date",
177180 "Unique Identifier": "slug"
178181 }
179182
183+ As a dictionary, it can be used to skip columns in the incoming sheets. For example,
184+ 'Noise' column is skipped because it was not mentioned in the mapdict.
185+
180186The custom initialization function is needed when the data from the excel sheet
181187needs translation before data import. For example, **Choice** has a foreign
182188key to **Question**. When choice data are to be imported, "Question" column
0 commit comments