Skip to content

feat: add optional django-import-export with generic FK-context import support#6603

Open
gourav-sraoss wants to merge 2 commits into
cookiecutter:mainfrom
gourav-sraoss:feat/optional-django-import-export
Open

feat: add optional django-import-export with generic FK-context import support#6603
gourav-sraoss wants to merge 2 commits into
cookiecutter:mainfrom
gourav-sraoss:feat/optional-django-import-export

Conversation

@gourav-sraoss

@gourav-sraoss gourav-sraoss commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an opt-in django-import-export integration to generated projects, including a reusable contrib package that solves a common pain point: selecting one FK value once in the import wizard and having it automatically applied to every imported row — without requiring that column in every line of the CSV file.

Default behaviour is unchanged ("use_django_import_export": "n").


Motivation

Admin-side CSV import/export is one of the most frequently needed features for operational Django projects — data migrations, bulk updates, support workflows. Yet wiring it up correctly (especially the shared-FK pattern) requires boilerplate that every team re-writes. This PR gives generated projects the integration out of the box, and eliminates that boilerplate entirely via a two-class contrib package.


What changed (2 commits, 5 files changed, 185 insertions)

1 — Template option and app wiring

File Change
cookiecutter.json New option use_django_import_export (default n)
pyproject.toml Conditionally adds django-import-export dependency
config/settings/base.py Conditionally adds import_export to THIRD_PARTY_APPS

2 — Generic FK-context contrib package

When the option is enabled, the generated project gains a ready-to-use contrib package:

@gourav-sraoss gourav-sraoss changed the title Add optional django-import-export integration for generated User admin feat: add optional django-import-export with generic FK-context import support Jun 1, 2026
@browniebroke

Copy link
Copy Markdown
Member

I used django-import-export in a few project, but I'm not convinced it should be added to the template.

While making it a project option could be a good compromise, a new option always adds complexity in terms of testing, and adds a question when people generate a new project.

At this stage, I don't think it's worth it, but I will leave this open for while to let people give feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants