F
Size: a a a
F
A
A
F
N
тн
A
IB
class ProductPhoto(models.Model):
author = models.CharField(max_length=20)
image = models.ImageField(upload_to='./img/')
def __str__(self):
return str(self.image)
class ProductPhotoForm(forms.ModelForm):
class Meta:
model = ProductPhoto
fields = ('author', 'image',)
widgets = {
'author': forms.TextInput(attrs={'style': 'width:100px'}),
'image': forms.ClearableFileInput(attrs={'multiple': True})
}
class ProductUpload(View):
def get(self, request):
form = ProductPhotoForm()
return render(request, 'upload.html', {'form': form})
def post(self, request):
bound_form = ProductPhotoForm(request.POST, request.FILES)
if bound_form.is_valid():
bound_form.save()
return render(request, 'upload.html', {'form': bound_form})
image = models.ImageField
N
class ProductPhoto(models.Model):
author = models.CharField(max_length=20)
image = models.ImageField(upload_to='./img/')
def __str__(self):
return str(self.image)
class ProductPhotoForm(forms.ModelForm):
class Meta:
model = ProductPhoto
fields = ('author', 'image',)
widgets = {
'author': forms.TextInput(attrs={'style': 'width:100px'}),
'image': forms.ClearableFileInput(attrs={'multiple': True})
}
class ProductUpload(View):
def get(self, request):
form = ProductPhotoForm()
return render(request, 'upload.html', {'form': form})
def post(self, request):
bound_form = ProductPhotoForm(request.POST, request.FILES)
if bound_form.is_valid():
bound_form.save()
return render(request, 'upload.html', {'form': bound_form})
image = models.ImageField
IB
S
N
IB
S
b
IB
IB
b
IB
widgets = {
'author': forms.TextInput(attrs={'style': 'width:100px'}),
'image': forms.ClearableFileInput(attrs={'multiple': True})
}
DL