drf-react-by-schema 0.16.5 → 0.16.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/api.js +7 -0
  2. package/package.json +1 -1
package/dist/api.js CHANGED
@@ -89,6 +89,13 @@ const getSchema = (path, serverEndPoint) => __awaiter(void 0, void 0, void 0, fu
89
89
  };
90
90
  }
91
91
  }
92
+ if (field.model_default && field.type === 'choice') {
93
+ if (field.choices) {
94
+ const modelDefault = field.choices.filter((choice) => choice.value === field.model_default);
95
+ options.actions.POST[key].model_default =
96
+ modelDefault.length === 1 ? modelDefault[0] : undefined;
97
+ }
98
+ }
92
99
  }
93
100
  const modelOptions = {
94
101
  name: options.name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drf-react-by-schema",
3
- "version": "0.16.5",
3
+ "version": "0.16.6",
4
4
  "description": "Components and Tools for building a React App having Django Rest Framework (DRF) as server",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",