I have a 4 buttons on first page which put me through to another page(All those 'buttons' are connected to database in mysql) and on this second page I have some data from mysql tables which I wanna display depending on what I have chosen in the first page. Right now I just display everything I have and I don't really know how to change that. I was looking for solutions but none worked.
views.py
def kategorie_list(request):
obj = Kategorie.objects.all()
context ={'obj': obj}
return render(request, "kategorie/lista.html", context)
def uslugodawcy_list(request):
obj = Uslugodawcy.objects.all()
context ={'obj': obj}
return render(request, "uslugodawcy/uslugodawcy_lista.html", context)
first html page
{% for Kategorie in obj %}
<p> <a class="btn btn-primary" href="/uslugodawcy"><button type="nw" style="height: 65px; width: 170px"> <font size="4">{{Kategorie.idkategorie}} . {{Kategorie.nazwakategorii}}</font> </button> </a> </p>
{% endfor %}
second
{% for Uslugodawcy in obj %}
<p> <a class="btn btn-primary" href="/promocje"><button type="nw" style="height: 65px; width: 170px"> <font size="4">{{Uslugodawcy.iduslugodawcy}} . {{Uslugodawcy.nazwa_uslugodawcy}} </font> </button> </a> </p>
{% endfor %}