2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-15 19:45:46 +00:00

Create a custom URL field, which allows the user-specified validators

- Ref: https://stackoverflow.com/questions/41756572/django-urlfield-with-custom-scheme
- Apply this to the URL field in the Part model
This commit is contained in:
Oliver Walters
2019-09-14 00:04:08 +10:00
parent ee17d5d3c3
commit 4ac8353099
3 changed files with 48 additions and 1 deletions

View File

@ -34,6 +34,7 @@ import hashlib
from InvenTree import helpers
from InvenTree import validators
from InvenTree.models import InvenTreeTree
from InvenTree.fields import InvenTreeURLField
from InvenTree.status_codes import BuildStatus, StockStatus, OrderStatus
@ -353,7 +354,7 @@ class Part(models.Model):
revision = models.CharField(max_length=100, blank=True, help_text='Part revision or version number')
URL = models.URLField(blank=True, help_text='Link to extenal URL')
URL = InvenTreeURLField(blank=True, help_text='Link to extenal URL')
image = models.ImageField(upload_to=rename_part_image, max_length=255, null=True, blank=True)