How to edit something saved in the database in Python

0

I need to search for a student by name or cpf that is saved in the database and retrieve that same student in a form so that you can edit it and then be saving again. I'm using Django as a framework. I've already done an html by creating the search field

{% extends 'aluno/index4.html' %}

{% block content %}
    <body>
        <div class="col-lg-6">
                <form class="input-group" action="." method="get">
                    <input type="text" name="pesquisar_por" class="form-control" placeholder="Pesquisar por...">
                    <span class="input-group-btn">
                        <button class="btn btn-primary" type="submit">Pesquisar</button>
                    </span>
                </form>
            </div>
    </body>
{% endblock %}

But I'm not sure how to integrate this with the view so that I'm rendering the form for editing. Can anyone give a help?

    
asked by anonymous 29.03.2018 / 18:49

1 answer

0

In short, you will use render() so that when your view is called by a url , after doing the job assigned to it, it responds to the user with a template (such as html that you yourself exemplified above).

Here you will find a brief explanation of the command quoted above, including an example. I recommend you take a look at the Django documentation on templates . Because it's a long, time-consuming thing to read first, but I can guarantee that it takes a lot of time to read the documentation before you start developing.

    
30.03.2018 / 02:32