2
0
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:
Oliver 2023-03-07 22:50:09 +11:00 committed by GitHub
parent 7e9283e5e4
commit af26664164
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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