'Ucenik matching query does not exist
I have a problem in views.py:
def profil(request, pk):
context = {
'profesor': Profesor.objects.get(id=pk),
'ucenik': Ucenik.objects.get(id=pk),
}
return render(request, 'profil.html', context)
when i go to page i got this error: Ucenik matching query does not exist.
my url.py:
path('profesor/', views.profesor, name='profesor'),
path('ucenik/', views.ucenik, name='ucenik'),
path('profil/<str:pk>/', views.profil, name='profil'),
if i delete: 'ucenik': Ucenik.objects.get(id=pk) then work, but on my profil.html page i need to display details Prfesor model and Ucenik model, i need both of them in def profil
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
