You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The xlsx_ignore_headers option allows specific fields to be excluded when
enumerating the serializer. This adds the ability to explicitly specify the
fields that should be included. The absence of the option will result in the
default behavior.
Copy file name to clipboardExpand all lines: README.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -235,11 +235,13 @@ By default, headers will use the same 'names' as they are returned by the API. T
235
235
236
236
Instead of using the field names, the export will use the labels as they are defined inside your Serializer. A serializer field defined as `title = serializers.CharField(label=_("Some title"))` would return `Some title` instead of `title`, also supporting translations. If no label is set, it will fall back to using `title`.
237
237
238
-
### Ignore fields
238
+
### Specify or ignore fields
239
239
240
-
By default, all fields are exported, but you might want to exclude some fields from your export. To do so, you can set an array with fields you want to exclude: `xlsx_ignore_headers = [<excluded fields>]`.
240
+
By default, all fields are exported. However, this behavior can be changed.
241
241
242
-
This also works with nested fields, separated with a dot (i.e. `icon.url`).
242
+
To include only a specified list of fields, provide them with: `xlsx_specify_headers = [<fields to include>]`. Conversely, to exclude certain fields from your export, provide them with: `xlsx_ignore_headers = [<excluded fields>]`.
243
+
244
+
These both work with nested fields, separated with a dot (i.e. `icon.url`).
243
245
244
246
### Date/time and number formatting
245
247
Formatting for cells follows [openpyxl formats](https://openpyxl.readthedocs.io/en/stable/_modules/openpyxl/styles/numbers.html).
0 commit comments