Freehand Kit Import Export: Django REST Framework CSV Import/Export API
freehand-kit-import-export gives Django and Django REST Framework projects a secure,
configuration-first API for importing and exporting model data as CSV. Register an
approved model once in Django settings; the package provides discoverable endpoints,
Swagger/OpenAPI documentation, CSV templates, dry-run validation, a durable import queue,
and bounded exports.
Status: stable. Version
1.0.0is the first stable release. It supports Python 3.11–3.13, Django 5.2–6.0, and Django REST Framework 3.17.x.
Why use this Django import/export package?
Most Django projects need CSV import and export sooner or later: product catalog uploads, member updates, back-office data fixes, onboarding data, or customer reports. Rebuilding serializers, CSV parsing, validation, permission checks, pagination, and API documentation for every model is repetitive and easy to get wrong.
Freehand Kit Import Export lets the host application keep control of its models and access rules while the package owns the reusable workflow. API callers can use only resources and fields that the host developer explicitly approves; they cannot submit arbitrary model names or field lists.
| You configure | The package provides |
|---|---|
| Django model, permitted fields, identifiers, relations, permissions, and optional owner/tenant scope | Resource discovery, CSV template, preview, confirmation, job history, records, and export APIs |
| Authentication in your project | Permission checks on every endpoint; the package never creates an authentication system |
| A worker or scheduler | Durable, retry-bounded import processing after an explicit confirmation |
| Private storage and retention policy | Source hashes, sanitized error reports, and safe cleanup commands |
Supported workflow
- A developer registers a model as a named resource, for example
products. - An authorized user downloads the exact CSV template or creates a matching UTF-8 CSV.
- The user uploads it to the preview endpoint. No model rows are written yet.
- The API returns a job with validation results. The user confirms only a successful preview.
- A background worker revalidates the saved file and atomically writes the model rows.
- The user polls the job, downloads sanitized errors when needed, lists records, or exports CSV.
Imports are CSV-only in 1.0.0. XLSX, JSON, and arbitrary model/field submission are not
supported by this package version.
Install and run your first import
python -m pip install freehand-kit-import-export
- Add
rest_framework,drf_spectacular, andfk_import_exporttoINSTALLED_APPS. - Register a resource in
FREEHAND_KIT_IMPORT_EXPORT. - Mount
/api/data/and the shared Swagger route at/api/docs/. - Run
python manage.py migrateandpython manage.py check --tag fk_import_export. - Run
python manage.py process_import_jobs --max-jobs 10under a worker or scheduler.
The complete copy-and-paste tutorial—including settings, URLs, CSV upload, preview, confirmation, worker processing, records, exports, errors, and production checklist—is in the quickstart guide.
Minimal Django configuration
# settings.py
INSTALLED_APPS = [
# Your Django apps...
"rest_framework",
"drf_spectacular",
"fk_import_export",
]
REST_FRAMEWORK = {
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
}
FREEHAND_KIT_IMPORT_EXPORT = {
"RESOURCES": {
"products": {
"MODEL": "inventory.Product",
"IMPORT_FIELDS": ("sku", "name", "price"),
"EXPORT_FIELDS": ("sku", "name", "price"),
"IMPORT_ID_FIELDS": ("sku",),
"SEARCH_FIELDS": ("sku", "name"),
"ORDERING_FIELDS": ("sku", "name", "price"),
"FILTER_FIELDS": (),
"PERMISSIONS": {
"READ": "inventory.view_product",
"EXPORT": "inventory.view_product",
"IMPORT": "inventory.change_product",
},
},
},
}
# urls.py
from django.urls import include, path
urlpatterns = [
path("api/data/", include("fk_import_export.urls")),
path("api/", include("fk_import_export.docs_urls")),
]
Visit /api/docs/ after starting the Django project. If your project already exposes a
central drf-spectacular schema—such as one mounted by fk_auth—do not mount
fk_import_export.docs_urls again. The existing /api/docs/ automatically includes these
endpoints.
Core features
- Plug-and-play Django REST Framework endpoints for approved Django models.
- CSV import preview and confirmation so invalid data is never written accidentally.
- Durable worker queue with retries, stale-job recovery, atomic commits, and job history.
- Secure relation handling with explicit unique lookups; related rows are never silently created.
- Per-resource Django permissions and direct owner/tenant scopes.
- Paginated records API with allowlisted search, ordering, and filters.
- Bounded CSV exports with spreadsheet formula-injection protection.
- Automatic Swagger/OpenAPI documentation at
/api/docs/and/api/schema/. - Sanitized error reports, lifecycle signals, and retention tools for operating imports safely.
Common use cases
- Django admin or operations teams importing product, inventory, pricing, customer, or membership CSV files.
- React, Vue, mobile, and partner clients using a documented Django REST Framework import API.
- SaaS applications that must isolate data by owner or tenant during import and export.
- Back-office systems that need searchable JSON records alongside downloadable CSV reports.
Security model
The package is intentionally restrictive:
- Only registered resources and explicit fields are exposed.
- Sensitive fields—passwords, staff flags, groups, permissions, and tokens—are denied by default.
- Uploads must be UTF-8
.csvfiles with exact headers and configured byte/row limits. - Preview and worker execution are transactional; confirming a job is safe to retry.
- Stored errors contain line numbers and categories, never uploaded cell values or raw database exceptions.
- CSV exports are capped and guarded against spreadsheet formula injection.
You must still configure your application's authentication, private media storage, permissions, tenant rules, backups, and monitoring. Read the security guide before accepting real customer data.
Documentation
- Start here: end-to-end quickstart
- Installation and URL setup
- Resource configuration reference
- API endpoint reference
- Worker, retries, and retention operations
- Custom authorization policies
- Lifecycle integration hooks
- Production-style Docker demo with a custom user model
- Security guidance
- Compatibility and supported versions
- Architecture decision
License
MIT. See LICENSE.
Metadata
Release files for freehand-kit-import-export 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| freehand_kit_import_export-1.0.0.tar.gz | 59.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| freehand_kit_import_export-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 100.3 kB
Release files / freehand_kit_import_export-1.0.0.tar.gz
| Download URL | freehand_kit_import_export-1.0.0.tar.gz |
|---|---|
| Size | 59.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4ca679f14a24e64c49f461f3f560174639a83001e9b920bdd2800593048fa7c1
|
|
BLAKE2b-256 checksum How to use checksums |
614290e14a9cd793ddbd93f1c13ebc8e0a4a21bd6150865875c5a0000c1e5856
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.
Transparency logRelease files / freehand_kit_import_export-1.0.0-py3-none-any.whl
| Download URL | freehand_kit_import_export-1.0.0-py3-none-any.whl |
|---|---|
| Size | 40.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0d8221cc2f8dd0b46a50c4f4ac961207bc625e1528453d87821c49cf46ac6481
|
|
BLAKE2b-256 checksum How to use checksums |
bcf4a8ce4ed8655f65ea301b82c54e1770e0315773fe2b3318ab0e7889a4a792
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.
Transparency log