diff --git a/docs/source/user/api.rst b/docs/source/user/api.rst index 1f12282d..b34982ba 100644 --- a/docs/source/user/api.rst +++ b/docs/source/user/api.rst @@ -694,6 +694,25 @@ Param Description phone_number string =============== =============================== + +Batch CSV Download +------------------- +.. code-block:: text + + /api/v1/radius/organization//batch//csv/ + +Responds only to **GET**. + +Parameters: + +=============== =============================== +Param Description +=============== =============================== +slug string +id string +filename string +=============== =============================== + Batch user creation ------------------- diff --git a/openwisp_radius/base/models.py b/openwisp_radius/base/models.py index 051cb044..a839c0f6 100644 --- a/openwisp_radius/base/models.py +++ b/openwisp_radius/base/models.py @@ -822,7 +822,13 @@ def __str__(self): def _get_csv_file_location(instance, filename): - return os.path.join(str(instance.organization.pk), filename) + return os.path.join( + str(instance.organization.slug), + 'batch', + str(instance.organization.pk), + 'csv', + filename, + ) class AbstractRadiusBatch(OrgMixin, TimeStampedEditableModel): diff --git a/openwisp_radius/settings.py b/openwisp_radius/settings.py index b6d1718a..a2eb47ee 100644 --- a/openwisp_radius/settings.py +++ b/openwisp_radius/settings.py @@ -131,7 +131,7 @@ def get_settings_value(option, default): ) # Path of urls that need to be refered in migrations files. -CSV_URL_PATH = 'api/v1/radiusbatch/csv/' +CSV_URL_PATH = 'api/v1/radius/organization/' CALLED_STATION_IDS = get_settings_value('CALLED_STATION_IDS', {}) CONVERT_CALLED_STATION_ON_CREATE = get_settings_value( 'CONVERT_CALLED_STATION_ON_CREATE', False