django-service-objects icon indicating copy to clipboard operation
django-service-objects copied to clipboard

Usage with uploaded files

Open mands opened this issue 5 years ago • 1 comments

Any help on how to use this library with uploaded files? I have it working for where I set the service object to normal Django form fields like forms.CharField (where the input data comes from a DRF serializers validated_data).

I've tried using form.FileField, where the input object is a TemporaryUploadedFile, but it keep raising the following exception when trying to clean the service object,

service_objects.errors.InvalidInputsError: ({'uploaded_file': ['This field is required.']}, [])

mands avatar Jun 15 '20 17:06 mands

@mands How are you calling the execute() class method of your service? (Please share code)

My guess is that you need to pass in the files argument to the service:

https://github.com/mixxorz/django-service-objects/blob/master/service_objects/services.py#L64

peterfarrell avatar Aug 10 '20 18:08 peterfarrell