mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Enable upload of company image via the API
This commit is contained in:
parent
f199feb8d9
commit
878f26c770
@ -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)
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user