I'm creating a ModelForm:
# .. forms.py ..
class myform(forms.ModelForm):
img = forms.ImageField(required=True, label='Required photo')
class Meta:
model = mymodel
fields = '__all__'
# .. view.py ..
def myview(request):
..
if Request.method = 'POST':
form = forms.myform(request.POST, request.FILES)
..
The issue is that I don't want to do file operations in a view, but I would like to make all the magic right in the form save() method. I see the following ways to do it:
(1) somehow access ImageField instance and it's data (2) somehow access request.FILES array via the form' instance
Please help me understand what way is the right one, and how could it be done?