Skip to content

Allow usage of references in loaddata

Nils Brinckmann requested to merge allow-usage-of-references-in-loaddata into main

This is another extension for the loaddata command that allows us to use references between newly created entries - without the need to know the exact ids.

A file like this:

            [
                {
                    "model": "ManufacturerModel",
                    "unique": ["manufacturer_name", "model"],
                    "fields": {
                        "manufacturer_name": "TRUEBENER GmbH",
                        "model": "SMT100"
                    },
                    "result": "truebener_smt_100"
                },
                {
                    "model": "ManufacturerModel",
                    "unique": ["manufacturer_name", "model"],
                    "fields": {
                        "manufacturer_name": "GFZ",
                        "model": "Custom"
                    },
                    "result": "gfz_custom"
                },
                {
                    "model": "ExportControl",
                    "unique": ["manufacturer_model"],
                    "fields": {
                        "dual_use": false,
                        "internal_note": "no dual use according to manufacturer"
                    },
                    "references": {
                        "manufacturer_model": "truebener_smt_100"
                    }
                },
                {
                    "model": "ExportControl",
                    "unique": ["manufacturer_model"],
                    "fields": {
                        "internal_note": "Still unknown"
                    },
                    "references": {
                        "manufacturer_model": "gfz_custom"
                    }
                }
            ]

will ensure that the set the export control data for the referenced manufacturer models.

Edited by Nils Brinckmann

Merge request reports

Loading