from django import template
from django.utils.safestring import mark_safe

register = template.Library()

@register.simple_tag
def upload_js():
    return mark_safe("""
<!-- The template to display files available for upload -->
<script id="template-upload" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
    <tr class="template-upload fade">
        <td>
            <span ><img src="/media/pictures/csv.png"></span>
        </td>
        <td>
            <p class="name">{%=file.name%}</p>
            {% if (file.error) { %}
                <div><span class="label label-important">{%=locale.fileupload.error%}</span> {%=file.error%}</div>
            {% } %}
        </td>
        <td>
            <p class="size">{%=o.formatFileSize(file.size)%}</p>
            {% if (!o.files.error) { %}
                <div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="progress-bar progress-bar-success" style="width:0%;"></div></div>
            {% } %}
        </td>
        <td>
            {% if (!o.files.error && !i && !o.options.autoUpload) { %}
                <button class="btn btn-primary start">
                    <i class="glyphicon glyphicon-upload"></i>
                    <span>{%=locale.fileupload.start%}</span>
                </button>
            {% } %}
            {% if (!i) { %}
                <button class="btn btn-warning cancel">
                    <i class="glyphicon glyphicon-ban-circle"></i>
                    <span>{%=locale.fileupload.cancel%}</span>
                </button>
            {% } %}
        </td>
        <td>
          <select class="form-control">
            <option value="paciente">Paciente</option>
            <option value="medico">Casos</option>
          </select>
        </td>
    </tr>
{% } %}
</script>
<!-- The template to display files available for download -->
<script id="template-download" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
    <tr class="template-download fade">
        <td>
            <span class="preview">
                {% if (file.thumbnailUrl) { %}
                    <img src="/media/pictures/csv.png">
                {% } %}
            </span>
        </td>
        <td>
            <p class="name">
                <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" >{%=file.name%}</a>
            </p>
            {% if (file.error) { %}
                <div><span class="label label-important">{%=locale.fileupload.error%}</span> {%=file.error%}</div>
            {% } %}
        </td>
        <td>
            <span class="size">{%=o.formatFileSize(file.size)%}</span>
        </td>
        <td>
            <button class="btn btn-danger delete" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}>
                <i class="glyphicon glyphicon-trash"></i>
                <span>{%=locale.fileupload.destroy%}</span>
            </button>
            <input type="checkbox" name="delete" value="1" class="toggle">
        </td>
    </tr>
{% } %}
</script>
""")







@@ -1077,592 +1077,8 @@
 td%3E%0A
-            %7B%25 if (!o.files.error && !i && !o.options.autoUpload) %7B %25%7D%0A                %3Cbutton class=%22btn btn-primary start%22%3E%0A                    %3Ci class=%22glyphicon glyphicon-upload%22%3E%3C/i%3E%0A                    %3Cspan%3E%7B%25=locale.fileupload.start%25%7D%3C/span%3E%0A                %3C/button%3E%0A            %7B%25 %7D %25%7D%0A            %7B%25 if (!i) %7B %25%7D%0A                %3Cbutton class=%22btn btn-warning cancel%22%3E%0A                    %3Ci class=%22glyphicon glyphicon-ban-circle%22%3E%3C/i%3E%0A                    %3Cspan%3E%7B%25=locale.fileupload.cancel%25%7D%3C/span%3E%0A                %3C/button%3E%0A            %7B%25 %7D %25%7D%0A        %3C/td%3E%0A        %3Ctd%3E%0A
     

UPDATE removed start/cancel buttons from individual files