mirror of
https://github.com/inventree/inventree-docs.git
synced 2025-04-27 21:26:43 +00:00
Update example for validation mixin plugin (#450)
This commit is contained in:
parent
7e9283e5e4
commit
af26664164
@ -47,8 +47,13 @@ Custom serial number validation can be implemented using the `validate_serial_nu
|
||||
A plugin which requires all serial numbers to be valid hexadecimal values may implement this method as follows:
|
||||
|
||||
```python
|
||||
def validate_serial_number(self, serial: str):
|
||||
"""Validate the supplied serial number"""
|
||||
def validate_serial_number(self, serial: str, part: Part):
|
||||
"""Validate the supplied serial number
|
||||
|
||||
Arguments:
|
||||
serial: The proposed serial number (string)
|
||||
part: The Part instance for which this serial number is being validated
|
||||
"""
|
||||
|
||||
try:
|
||||
# Attempt integer conversion
|
||||
|
Loading…
x
Reference in New Issue
Block a user