hi every one I am practice Django by a book “hello web app intermediate” in Uploading files in the templates,why I can not upload the images?? the urls.py views.py and error message here
Why I can not upload the images?
limedaring
#2
There might be a formatting issue with this line:
if form.is_valid():
Upload.objects.create(
image=form.cleaned_data['image'],
thing=thing,)
return redirect('edit_thing_uploads', slug=thing.slug)
Try formatting it like this?
if form.is_valid():
Upload.objects.create(
image=form.cleaned_data['image'],
thing=thing,
)
return redirect('edit_thing_uploads', slug=thing.slug)
limedaring
#4
<form role="form" action="" method="post" enctype="multipart/form\-data">
Should be:
<form role="form" action="" method="post" enctype="multipart/form-data">
Can you check to see if there are any other small errors or typos other than the above and try again?
cclin
#5
it works!,thank you so much,right ,I should check if any typos carefully,I read the book in kindle form and when the code switch to next line it will use \ and I thought it is the code,I misunderstood ,sorry,and thank you again ^ ^
limedaring
#6
Yeah, Kindle. :[ Did you buy from Amazon? I can send you my formatted PDF if so. Let me know.
cclin
#7
yes,I bought it from Amazon , if you can send me the PDF that will be great ! my gmail: [email protected],thank you ^ ^