Hello, i’m in deep struggling with an easy thing i think, probably too stressed to figure out the problem.
I created a model:
models.py
class Incarico(models.Model):
id = models.AutoField(primary_key=True)
incarico = models.DateField()
mandante = models.CharField(max_length=50, default=None)
I created 3 entries inside the database and created a page(slice_incarico) where to display these entries in this way:
views.py
def slice_incarico(request):
elements = Incarico.objects.all()
context = {‘elements’: elements}
return render(request, ‘incarico/slice_incarico.html’, context)
So i alwaays display into a table all the entries in the database referring to that model using html like so:
slice_incarico.html
{% for obje in elements %} {% endfor %}vai a: | ID | Incarico | Mandante |
---|---|---|---|
vai a ID | {{obje.id}} | {{obje.incarico}} | {{obje.mandante}} |
This structure create something like this right?
well, the missing part here is that i wish to use this button vai a ID
To jump into a new page (incarico_view) which will only let me visualize that specific entry.
I’m thinking about using the id, but i don’t know how, is very frustrating
Any help is much appreciated!!
Thanks in advance!