Reputation: 59
I have created two content types in Plone 4.3 via Dexterity and created a Plone Product on the file system.
The types are
Items can only exist in inside Supplier, and I can manually create new items without
I'd like to be able to create a bunch of items if I upload a CSV file while creating a supplier. Any way dexterity supports this (trigger, custom view...)?
Upvotes: 0
Views: 320
Reputation: 1121834
You'd have to handle that in a custom view. There is no pre-existing code to handle that.
For simple cases, just read the uploaded file with the csv
module and use the rows to create items in the Supplier
container:
from plone.dexterity.utils import createContentInContainer
import csv
reader = csv.reader(uploadedfile)
for row in reader:
createContentInContainer(supplier, 'your.package.item', title=row[0], ...)
For more complex operations, you could build a transmogrifier
pipeline with the transmogrify.dexterity
to convert CSV-data to dexterity objects, but that is probably overkill here.
Upvotes: 2