Prometheus
Prometheus

Reputation: 33625

CSV upload with no set format before upload

I'm using Django adaptors it works very well however, I'm starting to see CSV uploads where the user can decide what column the data belongs to after upload with no set format before upload.

Would it be possible to build this into Django Adaptors, if so could some point me in the right direction?

Or

Is there any app out there that could do this? (I have searched, with no joy)

Upvotes: 0

Views: 119

Answers (1)

singer
singer

Reputation: 2636

You need to inherit from CSVModel class and extend/overwrite get_fields method (and other methods if needed). This is common pattern for dynamic building instances of declarative classes.

Take a look on this code

ProductForm class, this is not exactly your case, but the point is the same.

Upvotes: 2

Related Questions