mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 05:05:42 +00:00 
			
		
		
		
	Allow empty URLs
This commit is contained in:
		| @@ -34,6 +34,19 @@ import logging | |||||||
| logger = logging.getLogger('inventree') | logger = logging.getLogger('inventree') | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class EmptyURLValidator(URLValidator): | ||||||
|  |  | ||||||
|  |     def __call__(self, value): | ||||||
|  |  | ||||||
|  |         value = str(value).strip() | ||||||
|  |  | ||||||
|  |         if len(value) == 0: | ||||||
|  |             pass | ||||||
|  |  | ||||||
|  |         else: | ||||||
|  |             super().__call__(value) | ||||||
|  |  | ||||||
|  |  | ||||||
| class BaseInvenTreeSetting(models.Model): | class BaseInvenTreeSetting(models.Model): | ||||||
|     """ |     """ | ||||||
|     An base InvenTreeSetting object is a key:value pair used for storing |     An base InvenTreeSetting object is a key:value pair used for storing | ||||||
| @@ -572,7 +585,7 @@ class InvenTreeSetting(BaseInvenTreeSetting): | |||||||
|         'INVENTREE_BASE_URL': { |         'INVENTREE_BASE_URL': { | ||||||
|             'name': _('Base URL'), |             'name': _('Base URL'), | ||||||
|             'description': _('Base URL for server instance'), |             'description': _('Base URL for server instance'), | ||||||
|             'validator': URLValidator(), |             'validator': EmptyURLValidator(), | ||||||
|             'default': '', |             'default': '', | ||||||
|         }, |         }, | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user