How to edit something saved in the Python database

Asked

Viewed 81 times

0

I need to search a student by name or Cpf that is saved in the database and recover this same student in a form to be able to edit it and later be saving again. I am using Django as a framework. I have already made an html 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 %}

However I am not able to integrate this with the view so I can render the form for editing. Someone can give a help?

1 answer

0

Briefly, you will use the render() so that when his view be called by a url, after doing the job assigned to it, it responds to the user with a template (like the html you yourself exemplified above).

Here you will find a brief explanation of the command I quoted above, including with an example. I recommend you take a look at Django’s documentation on templates. Because it is something very long and massante to read at first, but I can guarantee that it makes life much faster to read the documentation before you start to develop.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.