|
33 | 33 | Add ``feincms3_data`` to ``INSTALLED_APPS`` so that the included management |
34 | 34 | commands are discovered. |
35 | 35 |
|
36 | | -Add specs somewhere describing the models and relationships you want to dump, |
37 | | -e.g. in a module named ``app.specs``: |
| 36 | +Add datasets somewhere describing the models and relationships you want to |
| 37 | +dump, e.g. in a module named ``app.f3datasets``: |
38 | 38 |
|
39 | 39 | .. code-block:: python |
40 | 40 |
|
@@ -74,36 +74,44 @@ e.g. in a module named ``app.specs``: |
74 | 74 | ] |
75 | 75 |
|
76 | 76 |
|
77 | | - def specs(): |
| 77 | + def datasets(): |
78 | 78 | return { |
79 | | - "articles": lambda args: specs_for_app_models( |
80 | | - "articles", |
81 | | - {"delete_missing": True}, |
82 | | - ), |
83 | | - "pages": lambda args: specs_for_app_models( |
84 | | - "pages", |
85 | | - {"delete_missing": True}, |
86 | | - ), |
87 | | - "teachingmaterials": lambda args: specs_for_models( |
88 | | - [ |
89 | | - dashboard_models.TeachingMaterialGroup, |
90 | | - dashboard_models.TeachingMaterial, |
91 | | - ], |
92 | | - {"delete_missing": True}, |
93 | | - ), |
94 | | - "districts": districts, |
| 79 | + "articles": { |
| 80 | + "specs": lambda args: specs_for_app_models( |
| 81 | + "articles", |
| 82 | + {"delete_missing": True}, |
| 83 | + ), |
| 84 | + }, |
| 85 | + "pages": { |
| 86 | + "specs": lambda args: specs_for_app_models( |
| 87 | + "pages", |
| 88 | + {"delete_missing": True}, |
| 89 | + ), |
| 90 | + }, |
| 91 | + "teachingmaterials": { |
| 92 | + "specs": lambda args: specs_for_models( |
| 93 | + [ |
| 94 | + dashboard_models.TeachingMaterialGroup, |
| 95 | + dashboard_models.TeachingMaterial, |
| 96 | + ], |
| 97 | + {"delete_missing": True}, |
| 98 | + ), |
| 99 | + }, |
| 100 | + "districts": { |
| 101 | + "specs": districts, |
| 102 | + }, |
95 | 103 | } |
96 | 104 |
|
97 | 105 | Add a setting with the Python module path to the specs function: |
98 | 106 |
|
99 | 107 | .. code-block:: python |
100 | 108 |
|
101 | | - FEINCMS3_DATA_SPECS = "app.specs.specs" |
| 109 | + FEINCMS3_DATA_DATASETS = "app.f3datasets.datasets" |
102 | 110 |
|
103 | 111 |
|
104 | | -Now, to dump e.g. pages and teachingmaterials you would run:: |
| 112 | +Now, to dump e.g. pages you would run:: |
105 | 113 |
|
106 | | - ./manage.py f3dumpdata pages teachingmaterials > tmp/dump.json |
| 114 | + ./manage.py f3dumpdata pages > tmp/pages.json |
107 | 115 |
|
108 | 116 | To dump the districts with the primary key of 42 and 43 you would run:: |
109 | 117 |
|
@@ -134,7 +142,7 @@ Model specs consist of the following fields: |
134 | 142 |
|
135 | 143 | The dumps can be loaded back into the database by running:: |
136 | 144 |
|
137 | | - ./manage.py f3loaddata -v2 tmp/dump.json tmp/districts.json |
| 145 | + ./manage.py f3loaddata -v2 tmp/pages.json tmp/districts.json |
138 | 146 |
|
139 | 147 | Each dump is processed in an individual transaction. The data is first loaded |
140 | 148 | into the database; at the end, data *matching* the filters but whose primary |
|
0 commit comments