Enable upload of company image via the API

This commit is contained in:
Oliver 2021-06-23 08:39:06 +10:00
parent f199feb8d9
commit 878f26c770
3 changed files with 4 additions and 3 deletions

View File

@ -11,6 +11,7 @@ from .models import ManufacturerPart, ManufacturerPartParameter
from .models import SupplierPart, SupplierPriceBreak
from InvenTree.serializers import InvenTreeModelSerializer
from InvenTree.serializers import InvenTreeImageSerializerField
from part.serializers import PartBriefSerializer
@ -52,7 +53,7 @@ class CompanySerializer(InvenTreeModelSerializer):
url = serializers.CharField(source='get_absolute_url', read_only=True)
image = serializers.CharField(source='get_thumbnail_url', read_only=True)
image = InvenTreeImageSerializerField(required=False)
parts_supplied = serializers.IntegerField(read_only=True)
parts_manufactured = serializers.IntegerField(read_only=True)

View File

@ -139,9 +139,10 @@
enableDragAndDrop(
"#company-thumb",
"{% url 'company-image' company.id %}",
"{% url 'api-company-detail' company.id %}",
{
label: 'image',
method: 'PATCH',
success: function(data, status, xhr) {
location.reload();
}

View File

@ -304,7 +304,6 @@ class PartSerializer(InvenTreeModelSerializer):
suppliers = serializers.IntegerField(read_only=True)
image = InvenTreeImageSerializerField(required=False)
# image = serializers.CharField(source='get_image_url', read_only=True)
thumbnail = serializers.CharField(source='get_thumbnail_url', read_only=True)
starred = serializers.SerializerMethodField()