Skip to content

Commit b4232e0

Browse files
committed
Necesary changes for the PR acceptance
1 parent 4ab9cd0 commit b4232e0

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

README.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,17 @@ Performing exports with celery
158158
6. Click on the link near the bottom of the page titled `Exported file`.
159159

160160

161+
Excluding export file formats in the admin site
162+
-----------------------------------------------
163+
164+
All available file formats to export are taken from the `Tablib project <https://pypi.org/project/tablib/>`.
165+
166+
To exclude or disable file formats from the admin site, configure `IMPORT_EXPORT_CELERY_EXCLUDED_FORMATS` django settings variable. This variable is a list of format strings written in lower case.
167+
168+
::
169+
170+
IMPORT_EXPORT_CELERY_EXCLUDED_FORMATS = ["csv", "xls"]
171+
161172

162173
Customizing email template for export job completion email
163174
----------------------------------------------------------
@@ -186,7 +197,7 @@ The email template will get some context variables that you can use to customize
186197

187198

188199
::
189-
200+
190201
{
191202
export_job: The current instance of ExportJob model
192203
app_label: export_job.app_label

import_export_celery/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
DEFAULT_EXPORT_JOB_COMPLETION_MAIL_TEMPLATE = (
1010
"email/export_job_completion.html"
1111
)
12-
EXCLUDED_EXPORT_FORMATS = getattr(
12+
IMPORT_EXPORT_CELERY_EXCLUDED_FORMATS = getattr(
1313
settings,
14-
"EXCLUDED_EXPORT_FORMATS",
14+
"IMPORT_EXPORT_CELERY_EXCLUDED_FORMATS",
1515
[],
1616
)
1717

@@ -21,7 +21,7 @@ def get_formats():
2121
format
2222
for format in DEFAULT_FORMATS
2323
if format.TABLIB_MODULE.split(".")[-1].strip("_")
24-
not in EXCLUDED_EXPORT_FORMATS
24+
not in IMPORT_EXPORT_CELERY_EXCLUDED_FORMATS
2525
]
2626

2727

0 commit comments

Comments
 (0)