1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Reset documentation hierarchy

This commit is contained in:
Jeremy Stretch
2020-03-05 17:23:56 -05:00
parent f89773f4a3
commit a7c133daa6
21 changed files with 110 additions and 76 deletions

View File

@ -2,7 +2,7 @@
Below is a list of items to consider when adding a new field to a model:
### 1. Generate and run database migration
## 1. Generate and run database migration
Django migrations are used to express changes to the database schema. In most cases, Django can generate these automatically, however very complex changes may require manual intervention. Always remember to specify a short but descriptive name when generating a new migration.
@ -16,7 +16,7 @@ Where possible, try to merge related changes into a single migration. For exampl
!!! note
Migrations can only be merged within a release. Once a new release has been published, its migrations cannot be altered.
### 2. Add validation logic to `clean()`
## 2. Add validation logic to `clean()`
If the new field introduces additional validation requirements (beyond what's included with the field itself), implement them in the model's `clean()` method. Remember to call the model's original method using `super()` before or agter your custom validation as appropriate:
@ -32,23 +32,23 @@ class Foo(models.Model):
raise ValidationError()
```
### 3. Add CSV helpers
## 3. Add CSV helpers
Add the name of the new field to `csv_headers` and included a CSV-friendly representation of its data in the model's `to_csv()` method. These will be used when exporting objects in CSV format.
### 4. Update relevant querysets
## 4. Update relevant querysets
If you're adding a relational field (e.g. `ForeignKey`) and intend to include the data when retreiving a list of objects, be sure to include the field using `prefetch_related()` as appropriate. This will optimize the view and avoid excessive database lookups.
### 5. Update API serializer
## 5. Update API serializer
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 choices to API view
## 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
## 7. Add field to forms
Extend any forms to include the new field as appropriate. Common forms include:
@ -57,19 +57,19 @@ 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)
### 8. 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.
### 9. 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.
### 10. 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.
### 11. Create/extend test cases
## 11. Create/extend test cases
Create or extend the relevant test cases to verify that the new field and any accompanying validation logic perform as expected. This is especially important for relational fields. NetBox incorporates various test suites, including:

View File

@ -1,6 +1,8 @@
# Minor Version Bumps
# Release Checklist
## Update Requirements
## Minor Version Bumps
### Update Requirements
Required Python packages are maintained in two files. `base_requirements.txt` contains a list of all the packages required by NetBox. Some of them may be pinned to a specific version of the package due to a known issue. For example:
@ -23,7 +25,7 @@ pip install -U -r base_requirements.txt
3. Run all tests and check that the UI and API function as expected.
4. Update the package versions in `requirements.txt` as appropriate.
## Update Static Libraries
### Update Static Libraries
Update the following static libraries to their most recent stable release:
@ -33,41 +35,41 @@ Update the following static libraries to their most recent stable release:
* jQuery
* jQuery UI
## Squash Schema Migrations
### Squash Schema Migrations
Database schema migrations should be squashed for each new minor release. See the [squashing guide](squashing-migrations.md) for the detailed process.
## Create a new Release Notes Page
### Create a new Release Notes Page
Create a file at `/docs/release-notes/X.Y.md` to establish the release notes for the new release. Add the file to the table of contents within `mkdocs.yml`.
## Manually Perform a New Install
### Manually Perform a New Install
Create a new installation of NetBox by following [the current documentation](http://netbox.readthedocs.io/en/latest/). This should be a manual process, so that issues with the documentation can be identified and corrected.
## Close the Release Milestone
### Close the Release Milestone
Close the release milestone on GitHub. Ensure that there are no remaining open issues associated with it.
---
# All Releases
## All Releases
## Verify CI Build Status
### Verify CI Build Status
Ensure that continuous integration testing on the `develop` branch is completing successfully.
## Update Version and Changelog
### Update Version and Changelog
Update the `VERSION` constant in `settings.py` to the new release version and annotate the current data in the release notes for the new version.
## Submit a Pull Request
### Submit a Pull Request
Submit a pull request title **"Release vX.Y.X"** to merge the `develop` branch into `master`. Include a brief change log listing the features, improvements, and/or bugs addressed in the release.
Submit a pull request title **"Release vX.Y.Z"** to merge the `develop` branch into `master`. Include a brief change log listing the features, improvements, and/or bugs addressed in the release.
Once CI has completed on the PR, merge it.
## Create a New Release
### Create a New Release
Draft a [new release](https://github.com/netbox-community/netbox/releases/new) with the following parameters.
@ -77,7 +79,7 @@ Draft a [new release](https://github.com/netbox-community/netbox/releases/new) w
Copy the description from the pull request into the release notes.
## Update the Development Version
### Update the Development Version
On the `develop` branch, update `VERSION` in `settings.py` to point to the next release. For example, if you just released v2.3.4, set:
@ -85,6 +87,6 @@ On the `develop` branch, update `VERSION` in `settings.py` to point to the next
VERSION = 'v2.3.5-dev'
```
## Announce the Release
### Announce the Release
Announce the release on the [mailing list](https://groups.google.com/forum/#!forum/netbox-discuss). Include a link to the release and the (HTML-formatted) release notes.