Number models
django_rubble.models.number_models.NumberedModel
Bases: Model
Adds a number
field that uses DocumentNumber
to generate values.
Adds a natural_key
method to the model, but no manager that uses it.
Example:
class Invoice(NumberedModel):
number_config = SerialNumberConfig(
prefix="INV",
width=4,
initial_value=1,
step=1
)
Attributes:
Name | Type | Description |
---|---|---|
number_config |
SerialNumberConfig
|
A SerialNumberConfig instance. |
Source code in django_rubble\models\number_models.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
|
django_rubble.models.number_models.SerialNumberConfig
Bases: BaseModel
Configuration for NumberModel numbering.
Example
SerialNumberConfig(prefix="INV", width=4, initial_value=1, step=1)
->
INV0001
, INV0002
, etc.
Attributes:
Name | Type | Description |
---|---|---|
name |
str | None
|
The name of the model, used for NamedSerialNumber. |
initial_value |
int
|
The starting value for the serial number. |
step |
int
|
The increment value for the serial number. |
prefix |
str
|
The prefix for the serial number. |
Source code in django_rubble\models\number_models.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|