Maybe this is a very silly question but I'm new using django.
I have a certain django template with a set of properties that can be chosen. On an uploaded file I have to perform a different treatment depending on the chosen property, so I want to pass the chosen property value from the template to the view. Properies are hard coded in view.py and retrieved in the template by getJSON:
<script type="text/javascript">
$(function() {
$.getJSON('available_properties', function(data) {
var options = [];
for(var i in data.properties)
{
var prop = data.properties[i];
options.push('<option value="'+prop+'">'+prop+'</option>');
}
$("#properties > select").html(options.join(''));
});
});
</script>
Then an uploading file form trigger the action:
<form onsubmit="return checkfile();" prop="return get_prop();" action="calculate/<property_value_goes_here>" enctype="multipart/form-data" method="POST">
{% csrf_token %}
<input type="file" id="uploadfile" name="uploadfile" size="30">
<input type="submit" id="calculate" value="Calculate!">
</form>
How can I pass the property value directly in the URL path that must be called on the submit form?