i’m super not a programmer so this is definitely over my head. i understand what the command python manage.py loaddata whatever.json
does, but not at all how to make it work for me.
i need to add a reference to my model definition for every single piece of JSON data?
database ID? and it increments? that doesn’t make any sense - there’s only one database.
i’m following Hello Web App verbatim (other than thing
= recipe
and things
= recipes
) so i have no knowledge of an ID for anything database related.
here’s a very small sample of the recipe JSON file:
[
{
"data_value":382.0,
"name":"Glistering Melon",
"text_type":"speckled_melon",
"ingredients":[
{
"data_value":371.0,
"name":"Gold Nugget",
"text_type":"gold_nugget",
"quantity":8
},
{
"data_value":360.0,
"name":"Melon",
"text_type":"melon",
"quantity":1
}
],
"quantity":1,
"notes":"Glistering Melon is a brewing ingredient. The ingredients must be placed exactly as shown - they make a relevant shape in the crafting table.",
"category":"Brewing"
},
{
"data_value":378.0,
"name":"Magma Cream",
"text_type":"magma_cream",
"ingredients":[
{
"data_value":377.0,
"name":"Blaze Powder",
"text_type":"blaze_powder",
"quantity":1
},
{
"data_value":341.0,
"name":"Slimeball",
"text_type":"slime_ball",
"quantity":1
}
],
"quantity":1,
"notes":"Magma Cream is a brewing ingredient. It can be crafted and it can be dropped by Magma Cubes (25% chance). This recipe does not require a shape - ingredients can be placed in any slot in the crafting table.",
"category":"Brewing"
},
{
... etc
}
]