{% extends 'base.html' %}
{% load static %}

{% block title %}Files in {{ object.name }}{% endblock %}

{% block scripts %}
{{ block.super }}
<script type="text/javascript" src="{% static 'jquery.min.js' %}"></script>
<script>
window.addEventListener("DOMContentLoaded", function(event) {
  $("#file_list").load("{% url 'project-files-block' object.owner object.name %}");
  document.querySelector("form#upload input[type=file]").onchange = function () {
    document.getElementById("upload").submit();
  };
  document.querySelector("form#rename input[type=text]").onchange = function () {
    document.getElementById("rename").submit();
  };
});
</script>
{% endblock %}

{% block content %}
<h1>Files in {{ object.name }}</h1>
<div class="columns">
  <div class="column">
    <div id="file_list">Loading...</div>
  </div>
</div>
{% if object.owner == user %}
<form method="POST" enctype="multipart/form-data" id="upload">
  {% csrf_token %}
  {{ upload_form }}
  <input type="hidden" name="upload" value="1">
</form>
<form method="POST" id="rename">
  {% csrf_token %}
  {{ rename_form }}
  <input type="hidden" name="rename" value="1">
</form>
{% endif %}
{% endblock %}

{% extends 'base.html' %}
{% load static %}

{% block title %}Files in {{ object.name }}{% endblock %}

{% block scripts %}
{{ block.super }}
<script type="text/javascript" src="{% static 'jquery.min.js' %}"></script>
<script>
window.addEventListener("DOMContentLoaded", function(event) {
  document.getElementById("id_upload").disabled = true;
  $("#file_list").load(
    "{% url 'project-files-block' object.owner object.name %}",
    function() { document.getElementById("id_upload").disabled = false; }
  );
  document.querySelector("form#upload input[type=file]").onchange = function () {
    document.getElementById("upload").submit();
    this.disabled = true;
  };
  document.querySelector("form#rename input[type=text]").onchange = function () {
    document.getElementById("rename").submit();
  };
});
</script>
{% endblock %}

{% block content %}
<h1>Files in {{ object.name }}</h1>
<div class="columns">
  <div class="column">
    <div id="file_list">Loading...</div>
  </div>
</div>
{% if object.owner == user %}
<form method="POST" enctype="multipart/form-data" id="upload">
  {% csrf_token %}
  {{ upload_form }}
  <input type="hidden" name="upload" value="1">
</form>
<form method="POST" id="rename">
  {% csrf_token %}
  {{ rename_form }}
  <input type="hidden" name="rename" value="1">
</form>
{% endif %}
{% endblock %}

Disable upload button while reading object store
Disable upload button while reading object store
