28
docs/projects/centurion_erp/development/forms.md
Normal file
28
docs/projects/centurion_erp/development/forms.md
Normal file
@ -0,0 +1,28 @@
|
||||
---
|
||||
title: Forms
|
||||
description: Centurion ERP Forms development documentation
|
||||
date: 2024-07-14
|
||||
template: project.html
|
||||
about: https://gitlab.com/nofusscomputing/infrastructure/configuration-management/centurion_erp
|
||||
---
|
||||
|
||||
Forms are used within Centurion ERP as the method to display the data from the database. Along with that they are designed to sanitise the user entered data.
|
||||
|
||||
|
||||
## Requirements
|
||||
|
||||
All forms must meet the following requirements:
|
||||
|
||||
- is defined as a class
|
||||
|
||||
- inherits from `core.forms.common.CommonModelForm` _[docs](./api/form.md)_
|
||||
|
||||
- contains a `Meta` sub-class with following parameters:
|
||||
|
||||
- `fields`
|
||||
|
||||
- `model`
|
||||
|
||||
- Any additional filtering is done as part of an `__init__` method that also calls the super-class `__inti__` first
|
||||
|
||||
- Any filtering of a field `queryset` is to filter the existing `queryset` not redefine it. i.e. `field[<field name>].queryset.filter()`
|
@ -41,14 +41,14 @@ Icons with text:
|
||||
|
||||
Within Centurion ERP the navigation menu is dynamically built. To have an item added to the navigation bar to the left of the screen, the following items must be set:
|
||||
|
||||
- within the `urlpatterns` list, the path contains the name parameter.
|
||||
- within the `urlpatterns` list, the path contains the name parameter.
|
||||
|
||||
!!! tip
|
||||
Don't use a name that starts with `_`, as this prefix is designed to be used to prevent the url from showing up within the navigation menu
|
||||
|
||||
- `app_name = "<app name>"` set in `urls.py`
|
||||
|
||||
_Example entry_
|
||||
._Example entry_
|
||||
|
||||
``` py title="urls.py"
|
||||
|
||||
|
@ -43,9 +43,9 @@ All views are to meet the following requirements:
|
||||
|
||||
- View class has the following attributes definedL
|
||||
|
||||
- `form_class`
|
||||
- `form_class` for the display of [forms](./forms.md).
|
||||
|
||||
- `model`
|
||||
- `model` for which data [model](./models.md) to use.
|
||||
|
||||
- Add and change views to use a form class
|
||||
|
||||
@ -56,7 +56,7 @@ All views are to meet the following requirements:
|
||||
The below documentation is still to be developed. As such what is written below may be incorrect.
|
||||
|
||||
|
||||
#### Templates
|
||||
### Templates
|
||||
|
||||
The base template includes blocks that are designed to assist in rendering your content. The following blocks are available:
|
||||
|
||||
|
Reference in New Issue
Block a user