Why I can not upload the images?


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


There might be a formatting issue with this line:

if form.is_valid():
    return redirect('edit_thing_uploads', slug=thing.slug)

Try formatting it like this?

if form.is_valid():
    return redirect('edit_thing_uploads', slug=thing.slug)


I changed the formatting like that,but still can not upload

<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?


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 ^ ^


Yeah, Kindle. :[ Did you buy from Amazon? I can send you my formatted PDF if so. Let me know.


yes,I bought it from Amazon , if you can send me the PDF that will be great ! my gmail: [email protected],thank you ^ ^


Emailed! :)


got it ,thank you!