mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
PEP fixes
This commit is contained in:
parent
fe4acd48a7
commit
22ff085b15
@ -30,10 +30,10 @@ def TestIfImageURL(url):
|
|||||||
'.jpg', '.jpeg',
|
'.jpg', '.jpeg',
|
||||||
'.png', '.bmp',
|
'.png', '.bmp',
|
||||||
'.tif', '.tiff',
|
'.tif', '.tiff',
|
||||||
'.webp',
|
'.webp',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def str2bool(text, test=True):
|
def str2bool(text, test=True):
|
||||||
""" Test if a string 'looks' like a boolean value.
|
""" Test if a string 'looks' like a boolean value.
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ class UploadPartImage(AjaxView):
|
|||||||
part = Part.objects.get(pk=kwargs.get('pk'))
|
part = Part.objects.get(pk=kwargs.get('pk'))
|
||||||
except Part.DoesNotExist:
|
except Part.DoesNotExist:
|
||||||
response['error'] = 'Part not found'
|
response['error'] = 'Part not found'
|
||||||
return JsonResponse(error_dict, status=404)
|
return JsonResponse(response, status=404)
|
||||||
|
|
||||||
# Direct image upload
|
# Direct image upload
|
||||||
if 'image_file' in request.FILES:
|
if 'image_file' in request.FILES:
|
||||||
@ -325,7 +325,7 @@ class UploadPartImage(AjaxView):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
validator(image_url)
|
validator(image_url)
|
||||||
except ValidationError:
|
except ValidationError:
|
||||||
response['error'] = 'Invalid image URL'
|
response['error'] = 'Invalid image URL'
|
||||||
response['url'] = image_url
|
response['url'] = image_url
|
||||||
|
|
||||||
@ -361,7 +361,6 @@ class UploadPartImage(AjaxView):
|
|||||||
return JsonResponse(response, status=status)
|
return JsonResponse(response, status=status)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class PartEdit(AjaxUpdateView):
|
class PartEdit(AjaxUpdateView):
|
||||||
""" View for editing Part object """
|
""" View for editing Part object """
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user