@ -6,82 +6,9 @@ template: project.html
|
||||
about: https://github.com/nofusscomputing/centurion_erp
|
||||
---
|
||||
|
||||
Model Notes are a core feature that is intended to be used as the base for enabling a model to have notes assosiated to it.
|
||||
Model Notes is a core feature that is intended to be used so that users can place comments against a model. These comments are arbitrary. [Markdown](../../user/core/markdown.md) is supported. All Tenancy Models have model notes enabled by default.
|
||||
|
||||
|
||||
## Adding Notes to a Model
|
||||
## Adding Model Notes to a Model
|
||||
|
||||
Most of the work has already been done, all that is required to add notes to a model is the creation of the following:
|
||||
|
||||
- Model
|
||||
|
||||
- Serializer
|
||||
|
||||
- Viewset
|
||||
|
||||
|
||||
### Model
|
||||
|
||||
The model is a proxy model for `core.models.model_notes.ModelNotes`. This model requires a `models.ForeignKey` field named `model` to the model that will be receinving the notes.
|
||||
|
||||
|
||||
#### Example model
|
||||
|
||||
This example is for adding notes to the Manufacturer Model
|
||||
|
||||
``` py title="models/manufacturer_notes.py"
|
||||
|
||||
--8<-- "app/core/models/manufacturer_notes.py"
|
||||
|
||||
```
|
||||
|
||||
|
||||
### Serializer
|
||||
|
||||
The Serializer contains the items the parent serializer (`core.serializers.model_notes`) does not have. This serializer requires the standard serializers be created that **ALL** inherit from the model notes parent serializer.
|
||||
|
||||
|
||||
#### Example Serializer
|
||||
|
||||
This example is for adding notes to the Manufacturer Model
|
||||
|
||||
``` py title="serializers/manufacturer_notes.py"
|
||||
|
||||
--8<-- "app/core/serializers/manufacturer_notes.py"
|
||||
|
||||
```
|
||||
|
||||
|
||||
### ViewSet
|
||||
|
||||
The ViewSet is a class that inherits from the Model Notes base ViewSet class, `core.viewsets.model_notes.ViewSet`. The ViewSet is responsible for providing the Serializer, Documentation (Swagger UI) and Providing the Model.
|
||||
|
||||
|
||||
#### Example ViewSet
|
||||
|
||||
This example is for adding notes to the Manufacturer Model
|
||||
|
||||
``` py title="viewsets/manufacturer_notes.py"
|
||||
|
||||
--8<-- "app/core/viewsets/manufacturer_notes.py"
|
||||
|
||||
```
|
||||
|
||||
|
||||
## Testing
|
||||
|
||||
As with any other object within Centurion, the addition of a feature requires it be tested. The following Test Suites are available:
|
||||
|
||||
- `Unit`
|
||||
|
||||
- model - `core.tests.unit.model_notes.test_unit_model_notes.ModelNotesInheritedCases`
|
||||
|
||||
- Serializer - `core.tests.abstract.test_unit_model_notes_serializer.ModelNotesSerializerTestCases`
|
||||
|
||||
- Viewset - `api.tests.abstract.viewsets`
|
||||
|
||||
- `Functional`
|
||||
|
||||
- ViewSet - `core.tests.abstract.test_functional_notes_viewset`
|
||||
|
||||
- API fields render - `core.tests.abstract.model_notes_api_fields`
|
||||
By default there is nothing that you need to do to add Model Notes to a model. By virtue of inheriting from [`core.models.centurion.CenturionModel`](../api/models/centurion.md) or [`core.models.centurion.CenturionSubModel`](../api/models/centurion_sub.md) the model will have model notes setup automagically. This wizardry of the machine creates all of the necessary components that the moment you run the migrations the model has a fully functioning model notes system.
|
||||
|
17
docs/projects/centurion_erp/user/core/model_notes.md
Normal file
17
docs/projects/centurion_erp/user/core/model_notes.md
Normal file
@ -0,0 +1,17 @@
|
||||
---
|
||||
title: Model Notes
|
||||
description: Model Notes User Documentation as part of the Core Module for Centurion ERP by No Fuss Computing
|
||||
date: 2025-05-30
|
||||
template: project.html
|
||||
about: https://github.com/nofusscomputing/centurion_erp
|
||||
---
|
||||
|
||||
Model Notes is a core feature that is intended to be used so that users can place comments against a model. These comments are arbitrary. [Markdown](../../user/core/markdown.md) is supported.
|
||||
|
||||
|
||||
## Locating a Models Notes
|
||||
|
||||
On navigating to a models details page, you will see a tab called `Notes`. Clicking on this tab will display the models notes. You alsoo have the ability to add notes to a model should you desire to do so.
|
||||
|
||||
!!! tip
|
||||
To access the model notes, you must be granted the appropriate permissions
|
Reference in New Issue
Block a user