How can I pass the id of a product from a template to another template in django?


I am working on a project in django and I have the following problem I have a list of products in a table, which belong to a common list (list with id 26), as seen in the following image:

Now I need that when you click on the "add product" button, you can pass the id from the list (26) to a new product.

I had tried in the following way to pass the id the list to the form that I need, but I can not pass it: in my

def getid(request, id):
    li = Lista.objects.get(id=id)
    return render(request, 'core/form_producto.html', {

and in my

path('form_producto/<id>/', form_producto, name="form_producto"),

and finally pass it to the template of the new product form in the list ...

<input type="text" name="txtid" id="txtid" value="{{ }}">

How could I solve this? thank you very much

asked by Hector Jara 01.12.2018 в 12:45

0 answers