django-commons / drf-excel

An XLSX spreadsheet renderer for Django REST Framework.
BSD 3-Clause "New" or "Revised" License
217 stars 40 forks source link

Support Common media_type #60

Closed Kl0ven closed 2 years ago

Kl0ven commented 2 years ago

The default common media_type for xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet Is it possible to support this media_type. Maybe in configuration or via a classmethod.

For now I resorted to use :

from django.apps import AppConfig
from drf_excel.renderers import XLSXRenderer

class AppConfig(AppConfig):
    name = "app.app"
    verbose_name = _("app")

def ready(self):
        XLSXRenderer.media_type = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
willtho89 commented 2 years ago

You are correct. I made a PR #62 to fix this. I'm not sure if the old media_type was chosen deliberately