Kaynağa Gözat

Add reminder to update static field choices

Jeremy Stretch 7 yıl önce
ebeveyn
işleme
4e3567659a
1 değiştirilmiş dosya ile 9 ekleme ve 5 silme
  1. 9 5
      docs/development/extending-models.md

+ 9 - 5
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 `<app>.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.