I'm trying to get info from a model but without moving the url, let me explain by myself when I access to for example:
/list It shows the info and if I just make a click in there i can access to the complete info of this user, or book or something and the url change to detail/8/
Is there any way to get the information without show the id of the database in the url?
for example list/
I have some code but I d no have any idea how to do it, I hope you guys can help me.
urls:
url(r'^detalle/(?P<pk>[0-9]+)/$', views.detalle_id, name="detalle_id"),
url(r'^detalle/(?P<nombre>.*)/$', views.detalle_nombre),
views:
def detalle_id(request, pk):
detalle = Pregunta.objects.get(pk=pk)
Pregunta.objects.filter(id=pk).update(comentario='1')
return render(request, 'detalle.html', {'detalle': detalle})
def detalle_nombre(request, nombre):
detalle = Pregunta.objects.get(nombre=nombre)
return render(request, 'detalle.html', {'detalle': detalle})
def lista(request):
listadb = Pregunta.objects.all()
return render(request, 'lista.html', {'listadb':listadb})
Edit: from comments:
The reason of this is because I'm trying to make a client database and the users who will use the database will have access to some of them but not of all the data base so if a user set for example domain.com/89 will see the information or can edit of client No 89, this I have a lot reasons why I'm trying to do it like this. Believe me I need o get information on click but accessing without change the url just by click. is it possible ? do you have any idea