mirror of
https://github.com/inventree/inventree-docs.git
synced 2025-06-12 18:25:27 +00:00
Update example for validation mixin plugin (#450)
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user