Skip to content

Conversation

@gregjkal
Copy link
Collaborator

@gregjkal gregjkal commented Nov 5, 2025

  • Added additional fields to the CapturedEmail table
  • Added django-import-export and configured an import resource to handle the expected file headers

Import form:
Screenshot 2025-11-05 at 12 14 12 PM

Records successfully imported:
Screenshot 2025-11-05 at 11 01 32 AM

Testing notes:
In addition to testing the upload, please confirm the existing email capture flow (at http://localhost:8000/outreach/program_page/unordered) still works as before.

Copy link
Collaborator

@daveoconnor daveoconnor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@karimarie67
Copy link
Collaborator

karimarie67 commented Nov 18, 2025

@gregjkal I may be doing something wrong here. I created a file with some of the fields. I choose CSV for the file type and tried the import. I'm getting the following error:

Errors
The following fields are declared in 'import_id_fields' but are not present in the resource fields: e, m, a, i, l
Traceback (most recent call last):
File "/venv/lib/python3.13/site-packages/import_export/resources.py", line 873, in import_data_inner
self._check_import_id_fields(dataset.headers)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.13/site-packages/import_export/resources.py", line 1161, in _check_import_id_fields
raise exceptions.FieldError(
...<5 lines>...
)
import_export.exceptions.FieldError: The following fields are declared in 'import_id_fields' but are not present in the resource fields: e, m, a, i, l

Line number: 1 - 'e'
Line number: 2 - 'e'
Line number: 3 - 'e'

File is attached.
user_input - Sheet1.csv

@gregjkal
Copy link
Collaborator Author

Thanks @karimarie67. Not sure how or when that changed, but I've fixed it.

@karimarie67
Copy link
Collaborator

Looks good! I got the option to preview my entries and they imported as expected:
Screenshot 2025-12-01 at 13 07 04

Ready to merge to develop @gregjkal

@gregjkal gregjkal merged commit 34503e6 into develop Dec 1, 2025
4 checks passed
@gregjkal gregjkal deleted the gk/email-import branch December 1, 2025 19:00
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.

4 participants