Downloads

Below is an example configuration of a panel using the Downloads module:

{
    "label": "Downloads",
    "icon": "mdi mdi-download",
    "url_name": "grid_downloader",
    "allowed_user_groups": [],
    "allowed_users": [],
},

The grid_downloader is defined in polygon/apps/app_download/urls.py

urlpatterns = [
    get_url(
        url_name="grid_downloader",
        view=controller_views.GridView,
        view_params={
            "title": "Downloads",
            "panels": [
                {
                    "full_row": True,
                    "title": "Files to Download",
                    "width": 12,
                    "url_name": "frame_regular_table",
                    "url_action_name": "panel_downloader",
                },
            ],
        },
    ),
]

urlpatterns += [
    get_url(
        url_name="panel_downloader",
        view=module_views.RegularTable,
        view_params={
            "model": models.FileDownloader,
            "order_by": "-file_creation_dt",
            "apply_js": True,
            "field_definitions": {
                "file_creation_dt": {
                    "label": "Timestamp",
                    "format": "datetime",
                },
                "label": {
                    "label": "Report Name",
                },
                "category": {
                    "label": "Report Category",
                },
                "download_config": {
                    "label": "Download",
                    "format": "url_button",
                },
            },
            "include_filters_extra": {
                "is_active": True,
                "file_extension__in": ["xlsx", "csv", "pdf", "json", "zip"],
            },
        },
    ),
]

Last updated