question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ConfirmImportForm should include custom form fields sent by ImportForm

See original GitHub issue

Caveat: I’m new to Django Import/Export, so please correct me if I have the wrong ideas about the best ways of doing this.

My first use of DI/E required importing a file that was (deliberately) missing a column, with the intention of providing the extra column value in the import form. Eventually I worked out (what I think is) a good way of doing this, as I explained to someone else having the same problem - and then someone else, and someone else. In other words, it’s a pretty common problem.

But the use of sessions is messy, and may lead to weird bugs. It’d be better if ConfirmImportForm carried across all form fields by default, including custom ones. Alternatively, if there was a way to specify which extra form fields to include. Another alternative is #880, which would require more work from implementers but would allow much more flexibility.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
mgrdcmcommented, Dec 26, 2018

Hey! Sorry about that @yozlet. I’m having to dedicate all my time to getting a project ready first. Should be able to work on this over the weekend though!

1reaction
mgrdcmcommented, Dec 10, 2018

Hey there! So I’m doing a similar thing with no modifications to DIE and without using sessions, but it’s a bit hacky. I’ll post what I’m doing later.

Here’s what I’m hoping to do long-term, let me know how this sounds to you - a new import_export.fields.Field subclass that is basically a prompt with a Django Form widget and pulls the value from that prompt instead of an actual column. Basically a synthetic column. Then to add this all you’d have to do is add like

prompted_column = import_export.fields.PromptField(column_name="Yes or No or Maybe", form_widget=django.forms.widgets.NullBooleanSelect())

and then that would show up as like “Yes or No or Maybe: …” on the import form.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use Django-import-export ImportForm and ...
So now from my custom mixins ImportView and ConfirmImportView y can subclass the specific classes to import my specific models just setting ...
Read more >
django-import-export Documentation - Read the Docs
author field to select the author from. Customize forms: from django import forms class CustomImportForm(ImportForm): author = forms.
Read more >
django-import-export/django-import-export - Coveralls.io
1 from datetime import datetime 47× 3 import django 47× 4 from django import forms 47× 5 from django.conf import settings 47×
Read more >
django-import-export 数据导入导出 | We all are data. - pointborn
You can extend the import forms to include author field to select the author from. Customize forms: from django import forms class ...
Read more >
aptivate / django-import-export · GitLab - Git.Coop
Returns ResourceClass to use for import. 141. """ 142.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found