Skip to main content

Configure an export

For the XLSX example, clear the Category field. The demo uses UUID category identifiers, which the 1.0.23 XLSX writer cannot serialize directly. CSV or JSON can include them.

Configure an export (dark theme)
Configure an export (light theme)

Drag the divider or use the arrow keys to compare themes.

Configure an export
Configure an export (dark theme)
Configure an export (light theme)

Drag the divider or use the arrow keys to compare themes.

  1. Choose a format permitted by ExportOption. Excel produces XLSX.
  2. Synchronous execution returns the result in the same request.
  3. Choose the columns to write to the file.
  4. Submitting starts an operation under the create grant.
Configure an export

Django Chassis 1.0.23 · training site with Russian UI

  1. Choose a format permitted by ExportOption. Excel produces XLSX.
  2. Synchronous execution returns the result in the same request.
  3. Choose the columns to write to the file.
  4. Submitting starts an operation under the create grant.

How to add it​

Add this ExportOption to DeviceAdmin.options in catalog_demo/admins/device_admin.py. Declare the three codenames in Device.Meta.permissions, apply migrations and set up private STORAGES['media']. Give the exporting staff group the model view, export view and create grants. Start with a populated device changelist.

from django_chassis.enums import ExportFormat
from django_chassis.options import ExportOption

# DeviceAdmin.options entry
ExportOption(
view_permission='view_device_export', create_permission='create_device_export',
download_permission='download_device_export',
fields=['code', 'category', 'active', 'capacity'],
formats=[ExportFormat.JSON, ExportFormat.XML, ExportFormat.CSV, ExportFormat.XLSX]
)

Open /admin/catalog_demo/device/export/new/, choose Excel and synchronous execution, then select code, active and capacity.