From 4e3567659a04d461691e48c0eb88e1486af70cab Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 4 Dec 2018 15:19:38 -0500 Subject: [PATCH] Add reminder to update static field choices --- docs/development/extending-models.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/development/extending-models.md b/docs/development/extending-models.md index 190fad5e0..1fde8067b 100644 --- a/docs/development/extending-models.md +++ b/docs/development/extending-models.md @@ -44,7 +44,11 @@ If you're adding a relational field (e.g. `ForeignKey`) and intend to include th Extend the model's API serializer in `.api.serializers` to include the new field. In most cases, it will not be necessary to also extend the nested serializer, which produces a minimal represenation of the model. -### 6. Add field to forms +### 6. Add choices to API view + +If the new field has static choices, add it to the `FieldChoicesViewSet` for the app. + +### 7. Add field to forms Extend any forms to include the new field as appropriate. Common forms include: @@ -53,18 +57,18 @@ Extend any forms to include the new field as appropriate. Common forms include: * **CSV import** - The form used when bulk importing objects in CSV format * **Filter** - Displays the options available for filtering a list of objects (both UI and API) -### 7. Extend object filter set +### 8. Extend object filter set If the new field should be filterable, add it to the `FilterSet` for the model. If the field should be searchable, remember to reference it in the FilterSet's `search()` method. -### 8. Add column to object table +### 9. Add column to object table If the new field will be included in the object list view, add a column to the model's table. For simple fields, adding the field name to `Meta.fields` will be sufficient. More complex fields may require explicitly declaring a new column. -### 9. Update the UI templates +### 10. Update the UI templates Edit the object's view template to display the new field. There may also be a custom add/edit form template that needs to be updated. -### 10. Adjust API and model tests +### 11. Adjust API and model tests Extend the model and/or API tests to verify that the new field and any accompanying validation logic perform as expected. This is especially important for relational fields.