Models
Administration
SingletonModel
A Singleton model that ensures there is only one instance of this model that can not be deleted.
Source code in backend/administration/models.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
save(*args, **kwargs)
Overrides save for model to ensure there is only ever 1 instance.
Raises:
Type | Description |
---|---|
ValidationError(String)
|
Raises an error if there is already an instance of this model. |
Returns:
Name | Type | Description |
---|---|---|
self |
Model
|
Returns itself on save. |
Source code in backend/administration/models.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
delete(*args, **kwargs)
Overrides delete, not allowing deletions.
Raises:
Type | Description |
---|---|
ValidationError(String)
|
On deletion attemp, returns an error not allowing deletions. |
Source code in backend/administration/models.py
31 32 33 34 35 36 37 38 39 |
|
Version
Model representing app version.
Attributes:
Name | Type | Description |
---|---|---|
version_number |
CharField
|
The current version of the app. Required. |
Source code in backend/administration/models.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
|
__str__()
Returns:
Type | Description |
---|---|
String
|
The version number of the app. |
Source code in backend/administration/models.py
52 53 54 55 56 57 |
|
Material
Material
Model representing a material.
Attributes:
Name | Type | Description |
---|---|---|
material_object |
MaterialObject
|
A reference to a Material Object. Required. |
quantity |
IntegerField
|
The quantity of material objects. Required. |
material_status |
Optional[ForeignKey]
|
A reference to a Material Status. Defaults to None. |
project |
Optional[ForeignKey]
|
A refrence to a Project. Defaults to None. |
Source code in backend/material/models.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
|
__str__()
Returns:
Type | Description |
---|---|
String
|
The Material Object Name |
Source code in backend/material/models.py
172 173 174 175 176 177 |
|
MaterialObject
Model representing a material object.
Attributes:
Name | Type | Description |
---|---|---|
material_object_name |
CharField
|
The name of a material object. Required. |
thickness_in |
Optional[DecimalField]
|
The thickness of the object. Defaults to None. |
width_in |
Optional[DecimalField]
|
The width of the object. Defaults to None. |
length_in |
Optional[DecimalField]
|
The length of the object. Defaults to None. |
wood_species |
Optional[ForeignKey]
|
A refernce to a Wood Species object. Defaults to None. |
store |
Optional[ForeignKey]
|
A refrence to a Store. Defaults to None. |
store_aisle |
Optional[CharField]
|
The aisle of Store this material object can be |
store_bin |
Optional[CharField]
|
The bin of the aisle. Defaults to None. |
store_price |
Optional[DecimalField]
|
The price of this material object. Defaults to 0.00. |
material_object_full_name |
CharField
|
The full name of the object. Unique. Defaults to None. Limit 512. On save, set to dimensions + wood species name + material_object_name |
Source code in backend/material/models.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
|
save(*args, **kwargs)
Override save method to compute material_full_name before saving.
Source code in backend/material/models.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
|
__str__()
Returns:
Type | Description |
---|---|
String
|
The Material Object Name |
Source code in backend/material/models.py
137 138 139 140 141 142 |
|
MaterialStatus
Model representing a status for materials.
Attributes:
Name | Type | Description |
---|---|---|
material_status |
CharField
|
The text status of a material. Required. |
Source code in backend/material/models.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|
__str__()
Returns:
Type | Description |
---|---|
String
|
The Material Status |
Source code in backend/material/models.py
20 21 22 23 24 25 |
|
Store
Model representing a store
Attributes:
Name | Type | Description |
---|---|---|
store_name |
CharField
|
The name of a store. Required. Unique. |
Source code in backend/material/models.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|
__str__()
Returns:
Type | Description |
---|---|
String
|
The Store Name |
Source code in backend/material/models.py
59 60 61 62 63 64 |
|
WoodSpecies
Model representing a wood species for materials.
Attributes:
Name | Type | Description |
---|---|---|
wood_species_name |
CharField
|
The name of a species of wood. Required. |
Source code in backend/material/models.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|
__str__()
Returns:
Type | Description |
---|---|
String
|
The Wood Species Name |
Source code in backend/material/models.py
41 42 43 44 45 46 |
|
Note
attachment_name(instance, filename)
Takes a file instance and returns the attachment path with the file name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
instance
|
|
required | |
filename
|
String
|
The name of the file |
required |
Returns:
Type | Description |
---|---|
String
|
The path to attachments with the filename |
Source code in backend/note/models.py
11 12 13 14 15 16 17 18 19 20 21 22 23 |
|
Note
Model representing a note.
Attributes:
Name | Type | Description |
---|---|---|
note_date |
DateField
|
The date of the note. Required. |
note |
CharField
|
The text of the note. Required. |
attachment |
Optional[FileField]
|
Any attachment associated with this note. Dafaults to None. |
project |
Optional[ForeignKey]
|
A reference to a Project. Defaults to None. |
Source code in backend/note/models.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|
__str__()
Returns:
Type | Description |
---|---|
String
|
The Note Date |
Source code in backend/note/models.py
48 49 50 51 52 53 |
|
Part
Part
Model representing a part.
Attributes:
Name | Type | Description |
---|---|---|
quantity |
IntegerField
|
The quantity of this part. Required. |
part_name |
CharField
|
The name of the part. Required. 254 limit. |
part_status |
PartStatus
|
A reference to a Part Status. Required. |
rough_thickness_in |
DecimalField
|
The rough thickness of the part in inches. Required. |
rough_width_in |
DecimalField
|
The rough width of the part in inches. Required. |
rough_length_in |
DecimalField
|
The rough length of the part in inches. Required. |
finished_thickness_in |
DecimalField
|
The finished thickness of the part in inches. Required. |
finished_width_in |
DecimalField
|
The finished width of the part in inches. Required. |
finished_length_in |
DecimalField
|
The finished length of the part in inches. Required. |
project |
Project
|
A referece to a Project. Required. |
Source code in backend/part/models.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
|
__str__()
Source code in backend/part/models.py
62 63 |
|
PartStatus
Model representing a status for parts.
Attributes:
Name | Type | Description |
---|---|---|
part_status |
CharField
|
The text status of a part. Required. |
Source code in backend/part/models.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
|
__str__()
Source code in backend/part/models.py
22 23 |
|
Project
Project
Model representing a project.
Attributes:
Name | Type | Description |
---|---|---|
project_name |
CharField
|
The name of the poject. Required. Unique. 254 limit. |
project_status |
ProjectStatus
|
A reference to a Project Status. Required. |
project_image |
Optional[FileField]
|
An image for the project. Defaults to None. |
start_date |
Optional[DateField]
|
The date this project started. Defaults to None. |
due_date |
Optional[DateField]
|
The date this project is due. Defaults to None. |
completed_date |
Optioanl[DateField]
|
The date this project completed. Defaults to None. |
depth_in |
Optional[DecimalField]
|
The depth in inches. Defaults to 0. |
width_in |
Optional[DecimalField]
|
The width in inches. Defaults to 0. |
height_in |
Optional[DecimalField]
|
The height in inches. Defaults to 0. |
Source code in backend/project/models.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|
__str__()
Source code in backend/project/models.py
66 67 |
|
ProjectPhase
Model representing a phase for projects.
Attributes:
Name | Type | Description |
---|---|---|
project_phase |
CharField
|
The text phase of a project. Required. Unique. |
Source code in backend/project/models.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
|
__str__()
Source code in backend/project/models.py
82 83 |
|
ProjectStatus
Model representing a status for projects.
Attributes:
Name | Type | Description |
---|---|---|
project_status |
CharField
|
The text status of a project. Required. Unique. |
Source code in backend/project/models.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|
__str__()
Source code in backend/project/models.py
24 25 |
|
Task
Task
Model representing a task.
Attributes:
Name | Type | Description |
---|---|---|
task_name |
CharField
|
The name of the task. Required. Unique. 254 limit. |
task_status |
TaskStatus
|
A reference to a Task Status. Required. |
start_date |
Optional[DateField]
|
The date this task started. Defaults to None. |
due_date |
Optional[DateField]
|
The date this task is due. Defaults to None. |
completed_date |
Optional[DateField]
|
The date this task completed. Defaults to None. |
project |
Optional[Project]
|
A referece to a Project. Defaults to None. |
phase |
Optional[ProjectPhase]
|
A reference to a Project Phase. Defaults to None. |
step |
Optional[IntegerField]
|
The number representing the order of the step. Defaults to None. |
part |
Optioanl[Part]
|
A reference to a Part. Defaults to None. |
Source code in backend/task/models.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|
__str__()
Source code in backend/task/models.py
67 68 |
|
TaskStatus
Model representing a status for projects.
Attributes:
Name | Type | Description |
---|---|---|
task_status |
CharField
|
The text status of a task. Required. |
Source code in backend/task/models.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
|
__str__()
Source code in backend/task/models.py
23 24 |
|