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
Copy file name to clipboardExpand all lines: docs/api-guide/renderers.md
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -470,15 +470,15 @@ Modify your REST framework settings.
470
470
471
471
[MessagePack][messagepack] is a fast, efficient binary serialization format. [Juan Riaza][juanriaza] maintains the [djangorestframework-msgpack][djangorestframework-msgpack] package which provides MessagePack renderer and parser support for REST framework.
472
472
473
-
## XLSX (Binary Spreadsheet Endpoints)
473
+
## Microsoft Excel: XLSX (Binary Spreadsheet Endpoints)
474
474
475
-
XLSX is the world's most popular binary spreadsheet format. [Tim Allen][flipperpa] of [The Wharton School][wharton] maintains [drf-renderer-xlsx][drf-renderer-xlsx], which renders an endpoint as an XLSX spreadsheet using OpenPyXL, and allows the client to download it. Spreadsheets can be styled on a per-view basis.
475
+
XLSX is the world's most popular binary spreadsheet format. [Tim Allen][flipperpa] of [The Wharton School][wharton] maintains [drf-excel][drf-excel], which renders an endpoint as an XLSX spreadsheet using OpenPyXL, and allows the client to download it. Spreadsheets can be styled on a per-view basis.
476
476
477
477
#### Installation & configuration
478
478
479
479
Install using pip.
480
480
481
-
$ pip install drf-renderer-xlsx
481
+
$ pip install drf-excel
482
482
483
483
Modify your REST framework settings.
484
484
@@ -488,15 +488,15 @@ Modify your REST framework settings.
488
488
'DEFAULT_RENDERER_CLASSES': [
489
489
'rest_framework.renderers.JSONRenderer',
490
490
'rest_framework.renderers.BrowsableAPIRenderer',
491
-
'drf_renderer_xlsx.renderers.XLSXRenderer',
491
+
'drf_excel.renderers.XLSXRenderer',
492
492
],
493
493
}
494
494
495
495
To avoid having a file streamed without a filename (which the browser will often default to the filename "download", with no extension), we need to use a mixin to override the `Content-Disposition` header. If no filename is provided, it will default to `export.xlsx`. For example:
496
496
497
497
from rest_framework.viewsets import ReadOnlyModelViewSet
498
-
from drf_renderer_xlsx.mixins import XLSXFileMixin
499
-
from drf_renderer_xlsx.renderers import XLSXRenderer
498
+
from drf_excel.mixins import XLSXFileMixin
499
+
from drf_excel.renderers import XLSXRenderer
500
500
501
501
from .models import MyExampleModel
502
502
from .serializers import MyExampleSerializer
@@ -549,7 +549,7 @@ Comma-separated values are a plain-text tabular data format, that can be easily
0 commit comments