Skip to content
This repository was archived by the owner on Aug 12, 2020. It is now read-only.

Delete image in Django 1.6 #49

Closed
Arthedian opened this issue Jan 8, 2014 · 8 comments
Closed

Delete image in Django 1.6 #49

Arthedian opened this issue Jan 8, 2014 · 8 comments
Labels

Comments

@Arthedian
Copy link

I am using django 1.6 nrach. and when i try to delete image it wont do anything. Why?

@sigurdga
Copy link
Owner

sigurdga commented Jan 9, 2014

I need more information, as it works fine for me when using http://localhost:8000/upload/new/ to add and then delete. So which of the different types are you trying. Please try the one I used, which is the "basic plus UI" (the default). I assume you use the runserver as explained in the README?

@Arthedian
Copy link
Author

yeah I runserver like in README, but its only with jquery upload, when i use basic plus UI, than its OK. (Chrome)

@sigurdga
Copy link
Owner

The jquery UI example does not set the csrf-token correct. The browser that is responsible for setting csrf-token, and in the cookie-string it is correct, so there is probably a place this should be inserted into the cliend side javascript. The jquery-UI example was not written by me, and the upstream project does not handle csrf.

If you don't need csrf in your project, you could skip it (read the Django doc). If you don't need Jquery-UI, you could skip that as well. I'm not a good friend of Jquery-UI, and haven't looked at that part of the code yet.

I'm not sure when I will find the time to look closer at this. I tried setup a simple example, but it has been extended too much, and it seems people expect this to be a drop-in module they can run in production :(

If I were you, I would have a look at an alternative, like dropzone.js, and maybe my example: https://github.com/sigurdga/django-dropzone-upload

@Arthedian
Copy link
Author

ok thanks, i will look at this plugin

@Arthedian
Copy link
Author

dropzone is great plugin, but it doesnt have additional input data and input data for every file

@ET-CS
Copy link
Collaborator

ET-CS commented Jan 19, 2014

I tested and the delete button is not working for me either. I implemented csrf when I've added the examples (and I remember it worked?!) but something is clearly not working in the Jquery-UI example. I don't have time currently to look at it but I think maybe it can be resolved by adding reference to csrf.js in the html (I see it's missing).

@ET-CS
Copy link
Collaborator

ET-CS commented Jan 19, 2014

I tested it and adding script src="/static/js/csrf.js" to 'picture_jqeury_form.html' fixed the issue for me. @sigurdga can you commit this fix?

@sigurdga
Copy link
Owner

Thanks @ET-CS for the simple solution!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants