2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-20 22:06:28 +00:00

Add image download functionality for company

This commit is contained in:
Oliver Walters
2021-03-18 09:20:24 +11:00
parent 4e7243b999
commit 9c91ba4692
7 changed files with 129 additions and 5 deletions

View File

@ -1,16 +0,0 @@
{% extends "modal_form.html" %}
{% load inventree_extras %}
{% load i18n %}
{% block pre_form_content %}
<div class='alert alert-block alert-info'>
{% trans "Specify URL for downloading image" %}:
<ul>
<li>{% trans "Must be a valid image URL" %}</li>
<li>{% trans "Remote server must be accessible" %}</li>
<li>{% trans "Remote image must not exceed maximum allowable file size" %}</li>
</ul>
</div>
{% endblock %}

View File

@ -7,7 +7,7 @@
<div class="media">
<div class="media-left part-thumb-container">
<div class='dropzone' id='part-thumb'>
<img class="part-thumb"
<img class="part-thumb" id='part-image'
{% if part.image %}
src="{{ part.image.url }}"
{% else %}

View File

@ -843,7 +843,7 @@ class PartImageDownloadFromURL(AjaxUpdateView):
model = Part
ajax_template_name = 'part/image_download.html'
ajax_template_name = 'image_download.html'
form_class = part_forms.PartImageDownloadForm
ajax_form_title = _('Download Image')
@ -890,7 +890,7 @@ class PartImageDownloadFromURL(AjaxUpdateView):
response.raw.decode_content = True
try:
self.image = Image.open(response.raw).convert('RGB')
self.image = Image.open(response.raw).convert()
self.image.verify()
except:
form.add_error('url', _("Supplied URL is not a valid image file"))