Import action multiple models

Hi, I am working with an importer class. My use case is that one csv is converted to multiple models.

For example one row contains a card number. I first want to insert the card to retrieve a card_id.
I have the following models which need to be inserted based on this csv:
  • cards
  • cars
  • stations
  • countries
  • and the main one which are rows, containing foreign keys to all the above.
I know I can use the relationship method column but the problem is that for example cars is build up from license_plate. It is only needed in the cars relationship.

I am currently trying this approach, but was wondering if I am doing it wrong:
Was this page helpful?