It is the code of my Room model
class Room(models.Model):
#host
#topic
name=models.CharField(max_length=200)
desccription=models.TextField(null=True, blank=True)
#participants=
updated=models.DateTimeField(auto_now=True)
created=models.DateTimeField(auto_now_add=True)
and here in views.py , I'm trying to get id
def room(request, pk):
room=Room.objects.get(id=pk)
context={'room':room}
return render(request, 'base/room.html', context)
but it shows error
AttributeError at /room/1/
'Room' object has no attribute 'get'
Request Method: GET
Request URL: http://127.0.0.1:8000/room/1/
Django Version: 4.0.4
Exception Type: AttributeError
Exception Value:
'Room' object has no attribute 'get'