Comments (4)
Hi Pavel,
the upload handler view is expected to receive form data, so if you
would like to include additional data (e.g. 'some_key') it would be
sensible to include it as form data rather than GET variables.
The jQuery File Upload fileupload
function allows the inclusion of
additional form data in its POST requests. This functionality is
actively exploited by Django-JFU to supply Django with a valid CSRF
token. ::
$('#fileupload').fileupload({
formData: [
{ name: "csrfmiddlewaretoken", value: "{{ csrf_token }}"}
],
...
Please inspect the JS_INIT
block in jfu/templates/jfu/upload_form.html
for an idea of what to modify.
Best Regards,
Zerse
On Tue, Sep 17, 2013 at 03:05:30AM -0700, Pavel Zaytsev wrote:
Hello!
How to use JFU for add variable in upload view?
For example, set some keys for YourUploadModel@require_POST def upload( request, some_key ): file = upload_receive( request ) instance = YourUploadModel( some_key=some_key, sfile_field = file ) instance.save() ...
Reply to this email directly or view it on GitHub:
#5
from django-jfu.
Hello Alem!
Big thanks! It`s work fine!
I set in my template:
{% block JS_INIT %}
$('#fileupload').fileupload({
formData: [
{ name: "csrfmiddlewaretoken", value: "{{ csrf_token }}"},
{ name: "some_id", value: "{{some.id}}"}
],
{% block JS_OPTS %}
autoUpload: true,
maxNumberOfFiles: 10,
sequentialUploads: true,
{% endblock %}
});
{% endblock %}
and in view
some_id=int(request.REQUEST.get('some_id'))
from django-jfu.
@stelzzz i was working on the same thing, do you know how to save the data in the database in upload function after retrieval from the template?
from django-jfu.
I tried but not working
from django-jfu.
Related Issues (20)
- How can i add {% jfu %} in another form or two form at a time
- Static content collision
- How can I pass extra variable from upload views to the template ?
- How to limit Size Upload
- SyntaxError: JSON.parse: unexpected character at line 2 column 1 of the JSON data
- Added more fields in models from upload view HOT 2
- Update multiple image object django_jfu
- set limit for image upload
- How we make jfu form ass mandatory
- Display list of files
- $('#fileupload').fileupload({...}) is not a function HOT 2
- for image i use s3 amazon bucket so it return 500 INTERNAL SERVER ERROR HOT 1
- Allow more than 10 files simultaneously?
- django-jfu
- django 1.9 - RemovedInDjango110Warning: django.core.context_processors HOT 1
- maxNumberOfFiles not accessible in template
- if name of image is large so it return "ineternal server error" in image upload
- Video upload custom template??
- why does photo.file.name contain local path?
- Take the control over this module and merge the best HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-jfu.