满足条件时更改Django模板中的值

时间:2020-05-19 16:09:01

标签: python django

我想做的是,当充满该标签后面的条件时,包含文本“ Pendiente ...”的表中的最后一个td标签更改为“ Finalizado”,我试图在该条件内插入但只会添加另一个td,当我想要的只是更改其中的文本!我可以帮忙吗?

模板

{%extends 'base.html'%}
{%load staticfiles%}
{%block body_block%}
<link rel="stylesheet" href="{%static 'appointments/css/appointments_index.css'%}">
    {%if consults%}
    <h1 id="Heading">Consultas <h5  id="Date">{% now "j F Y" %}</h5></h1>
        <table align="center">
            <thead>
                <th>Codigo de Paciente</th>
                <th>Paciente</th>
                <th>Fecha</th>
                <th>Motivo</th>
                <th>Padecimiento</th>
                <th>Estado</th>
            </thead>
            <tbody>
                {%for consult in consults%}
                        <tr>
                            <td>{{consult.Paciente.Codigo}}</td>
                            <td>{{consult.Paciente.Nombres}} {{consult.Paciente.Apellidos}}</td>
                            <td>{{consult.Fecha}}</td>
                            <td>{{consult.Motivo}}</td>
                            <td>{{consult.Padecimiento}}</td>
                            <td>Pendiente...</td>
                            <td><div class="perform"><a href="{%url 'appointmentupdate' consult.id %}">Realizar</a></div></td>
                            {% if consult.Medicamento%}
                                <td><div class="receipt"><a href="">Receta</a></div></td>
                            {%endif%}
                        </tr>
                {%endfor%}
            </tbody>
        </table>
        {% if is_paginated %}
        <div class="pagination">
            <span class="page-links">
                {% if page_obj.has_previous %}
                    <a href="/patients?page={{ page_obj.previous_page_number }}">Anterior</a>
                {% endif %}
                <span class="page-current">
                    Pag {{ page_obj.number }} de  {{ page_obj.paginator.num_pages }}.
                </span>
                {% if page_obj.has_next %}
                    <a href="/patients?page={{ page_obj.next_page_number }}">Siguiente</a>
                {% endif %}
            </span>
        </div>
        {% endif %}

    {%else%}
    <h1 id="noregisters">No tiene consultas pendientes.</h1>
    {%endif%}

    <button id="Add"><a class="fas fa-plus" href="{%url 'addappointment'%}"></a></button>
    <button id="Registers"><a href="{%url 'appointmentlist'%}">Registros</a></button>
{%endblock%}

1 个答案:

答案 0 :(得分:1)

怎么样:

std::string str = "model.tflite";
ifstream file(str, std::ifstream::binary);
file.seekg(0, file.end);
int length = file.tellg();
file.seekg(0, file.beg);
char * model_data = new char [length];
file.read (model_data, length);
file.close();
std::unique_ptr<tflite::Interpreter> interpreter;
std::unique_ptr<tflite::FlatBufferModel> model;
tflite::ops::builtin::BuiltinOpResolver resolver;
model = tflite::FlatBufferModel::BuildFromBuffer(model_data, length);
tflite::InterpreterBuilder(*model, resolver)(&interpreter);
interpreter->AllocateTensors();