Can a txt file be used with this site to store statistics over reloads? {% extends "base.html" %}
{% load i18n %}

{% block messages %}{% endblock %}
{% block head_styles %}
    .messages > .alert {
        height: 100%;
    }
    .btn.btn-success.btn-full-width {
        width: 80%;
    }
    #countdown-timer {
        color: gray;
        text-align: center;
        margin-top: 20px;
        font-size: 14px;
    }
{% endblock %}

{% block main_container %}
<div class="row">
    <div class="col-md-12 col-xs-12">
        <h3>{% trans "Master Label" %} {{ unit_pack.ware_pack.number }} {% trans "Unit Label" %} {{ unit_pack.number }} {% trans "Station" %} {{ station.name }}</h3>
    </div>
</div>
<div class="row">
    <div class="col-md-6 col-xs-12 messages">
        <div class="alert alert-info"></div>
    </div>
    <div class="col-md-6 col-xs-12">
       <form id="scan-form" class="form-inline">
           <div class="input-group">
               <span class="glyphicon glyphicon-barcode input-group-addon"></span>
               <input id="id-scan" maxlength="255" name="scan" type="text" placeholder="{% trans 'Scan here' %}" autofocus autocomplete="off">
           </div>
           <input type="submit" class="btn btn-primary" value="{% trans "Confirm" %}" />
        </form>
        <br />
        <table class="table table-striped">
            <thead>
                <tr>
                    <th>{% trans "Identifier" %}</th>
                    <th>{% trans "Unique Value" %}</th>
                    <th>{% trans "Counter" %}</th>
                </tr>
            </thead>
            <tbody>
                {% for p in parts %}
                    {% if station.quality_check %}
                        {% if not p.control_time %}
                            <tr>
                                <td colspan="2"><button onclick="checkPart('{{ p.id }}', 'quality_control', 'ok', $(this))" type="button" class="btn btn-success btn-full-width">OK</button></td>
                                <td><button onclick="checkPart('{{ p.id }}', 'quality_control', 'nok', $(this))" type="button" class="btn btn-danger btn-full-width">NOK</button></td>
                            </tr>
                        {% endif %}
                    {% endif %}
                    <tr>
                        <td>{{ p.identifier }}</td>
                        <td>{{ p.recognized_unique }}</td>
                        <td>{{ forloop.revcounter }} / {{ unit_pack.capacity }}</td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
</div>

<!-- Countdown Timer -->
<div id="countdown-timer"></div>

<script>
    var delayTime = 5000;
    var countdownTime = (delayTime / 1000) -1;
    var countdownInterval;

    function updateCountdown() {
        var countdownElement = document.getElementById("countdown-timer");
        if (countdownTime >= 0) {
            countdownElement.innerHTML = "Visual inspection: " + countdownTime + "s";
            countdownTime--;
        } else {
            clearInterval(countdownInterval);
            countdownElement.innerHTML = "Timer finished";
        }
    }

    function startCountdown() {
        countdownTime = (delayTime / 1000) -1;
        clearInterval(countdownInterval);
        countdownInterval = setInterval(updateCountdown, 1000);
    }

    function checkPart(val, mode, quality_status = "ok", elem = null) {
        console.log('checkPart');
        console.log(val);
        $.ajax({
            url: "{% url "ajax_add_part_number_url" unit_pack.ware_pack_id unit_pack.id %}",
            type: "GET",
            data: {'part': val, 'mode': mode, 'quality_status': quality_status},
            async: false,
            cache: false,
            success: function (data) {
                if (data.status == "reload") {
                    window.location.reload();
                }
                if (data.status == "success") {
                    $(".alert").remove();
                    {% if station.quality_check %}
                    if (data.hasOwnProperty("control_time")) {
                        // Unlock form
                        $("#scan-form input").prop('disabled', false);
                        $("#scan-form input#id-scan").focus();

                        $(".alert").remove();
                        $(".messages").prepend("<div class=\"alert alert-" + data.status + "\"><h1>" + data.message + "</h1></div>");
                        elem.closest("tr").remove();
                    } else {
                        // Lock form
                        $("#scan-form input").prop('disabled', true);
                        $("<tr><td>" + data.identifier + "</td><td>" + data.unique + "</td><td>" + data.counter + "</td></tr>").prependTo("table > tbody").fadeOut(0).fadeIn('slow');
                        setTimeout(function () {
                            $("<tr><td colspan=\"2\"><button onclick=\"checkPart('" + data.part_id + "', 'quality_control', 'ok', $(this))\") type=\"button\" class=\"btn btn-success btn-full-width\">OK</button></td>"
                                + "<td><button onclick=\"checkPart('" + data.part_id + "', 'quality_control', 'nok', $(this))\") type=\"button\" class=\"btn btn-danger btn-full-width\">NOK</button></td></tr>").prependTo("table > tbody").fadeOut(0).fadeIn('slow');
                        }, delayTime);
                    }
                    {% else %}
                    $("<tr><td>" + data.identifier + "</td><td>" + data.unique + "</td><td>" + data.counter + "</td></tr>").prependTo("table > tbody").fadeOut(0).fadeIn('slow');
                    {% endif %}
                    if (data.new_layer == true) {
                        $(".messages").prepend("<div class=\"alert alert-warning \"><h1>{% trans "Warning! New layer." %} " + data.message + "</h1></div>");
                    } else {
                        $(".messages").prepend("<div class=\"alert alert-" + data.status + "\"><h1>" + data.message + "</h1></div>");
                    }
                    startCountdown();
                } else if (data.status == "full") {
                    window.location.replace("{% url "scan_unit_pack_url" unit_pack.ware_pack_id %}");
                } else {
                    $(".messages").prepend("<div class=\"alert alert-" + data.status + "\"><h1>" + data.message + "</h1></div>");
                    checkAlert();
                }
            }
        });
    }

    checkAlert();
    $(document).ready(function (event) {
        $('form[id=scan-form]').submit(function (event) {
            event.preventDefault();
            var scanValue = $("#scan-form input[name=scan]").val();
            var reArr;
            reArr = /{{ ware_catalog_client.re_model }}/.exec(scanValue);
            if (reArr != null) {
                reArr = /{{ ware_catalog_client.re_unique }}/.exec(scanValue);
                if (reArr != null) {
                    checkPart(scanValue, "add_part");
                } else {
                    $(".messages").prepend("<div class=\"alert alert-error\"><h1>{% trans "Scan unrecognized" %} brak unikalnego numeru w (" + scanValue + ")</h1></div>");
                    checkAlert();
                }
            } else {
                $(".messages").prepend("<div class=\"alert alert-error\"><h1>{% trans "Scan unrecognized" %} brak modelu w (" + scanValue + ")</h1></div>");
                checkAlert();
            }
            $("#scan-form input[name=scan]").val("");
        });
    });
</script>
{% endblock %}