Hello, Django community! I’ve just been through the awesome “polls” tutorial series, and now I’m starting my first real project- a family tree.
I’m planning to write code to populate initial database records from an external GEDCOM (text) file- would that go in the model code? Is there a convention on where/how this sort of thing should live in a Django project?
Additionally you could use a custom management command to import from your GEDCOM files. If this is data you always want loaded, you can consider a data migration or a post_migrate handler.
I personally don’t find Django’s Fixtures to be useful with data imports.
As Adam suggested, I would write a Django Management Command to read your data file. While I have never tried to access a GEDCOM data file (I see several on GitHub and pypi) and then import them one record at a time.
Django’s update_or_create() might be useful to you. I use it (or the alternative, get_or_create) when I write custom importers so that I can re-run them multiple times without duplicating what I have already imported.