-
-
Notifications
You must be signed in to change notification settings - Fork 782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No proper way to create customizable ModelResource #1034
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@andreynovikov I think this might be solved now in 2.1.0 by #994 and #1108. Can you confirm? |
Should be fixed by #1185 |
This seems to be solved. I will close it for now. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I needed to customize my
ModelResource
behavior for each import. The most straightforward way is to add extra field toImportForm
. But there is no way to access form data fromModelResource
.The first issue is that
get_import_resource_kwargs
knows nothing about import forms. Thanks it knows aboutrequest
. So the first ugly hack was to recreate and re-validate my custom import form inside this method.But the next issue is even worse: custom field value from
ImportForm
should be passed throughConfirmImportForm
but the solution from documentation can not work. See:django-import-export/import_export/admin.py
Line 322 in 3cf5e3f
Fortunately there is currently a typo in this line, it obviously should be:
This typo makes possible second ugly hack to access
ImportForm
data to initializeConfirmImportForm
. But when you will fix it there would be no way to do that.I suggest this part of import workflow should be redesigned.
The text was updated successfully, but these errors were encountered: