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

Upload/Start button not working if url is changed #41

Closed
abhijo89 opened this issue Oct 19, 2013 · 3 comments
Closed

Upload/Start button not working if url is changed #41

abhijo89 opened this issue Oct 19, 2013 · 3 comments

Comments

@abhijo89
Copy link

I am create a image gallery project using this app .

and my url :

url(r'^(?P<album_pk>\d+)/$', AngularVersionCreateView.as_view(), name='upload-angular'),

I did not do any other changes but it upload url shows still 'http://localhost:8000/upload/angular/'

how can i dynamically assign 'album_pk' to the upload button. What other changes i have to do while doing this . Where the url is hard coded

i request someone support to do this. i was working django 1.3. So i am not good in the class level view and other stuff in the code base.

@iamgollum
Copy link

I am trying to figure out this same problem as well. I am customizing the urls to accept a primary key and I am currently using a custom model.

Interestingly enough in main.js, /upload/view/ is hard coded ... so this can be changed if need be.
I have tried locating where /upload/new/ is being called and with no success. It is clearly making the POST requests though? I am stuck too.

My url shows up as: 'http://localhost:8000/upload/new/' when it should be 'http://localhost:8000/upload/new/some_number'

This may be helpful, although this is based on the php version:
http://stackoverflow.com/questions/9398187/jquery-file-upload-plugin-how-to-change-the-upload-path

MY SOLUTION

So unlike php server version used in the demo, the django version is using the action="" method ONLY. So make sure you pass in the correct url to the action method. By default the template I am using is set to action="." so what you can do is either:

action=".{{pk_value}}" or action="{% url 'to view name or whatever' %}"

Note I am using Django 1.5!!

@abhijo89
Copy link
Author

I fixed this issue by setting up the option in the html template .

data-file-upload="options"

Changed to

data-file-upload="{url:'/upload/{{album_pk}}/'}"

@ET-CS
Copy link
Collaborator

ET-CS commented Oct 22, 2013

changes to the URL should be updated in the .js file too. main.js file is used by the basic plus version. for the angular version there is the app.js file.

Note: also, some of the templates are using {% verbatim %} which is supported only from Django 1.5+. Angular version, if I remember right doesn't use it.

@ET-CS ET-CS closed this as completed Oct 22, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants