django models request get id error Room matching query does not exist
You are looking into request.POST, even if the request.method is not equal to 'POST'. This will not work, because when the request is not an HTTP-post, the POST-member of your request is empty.
i have two models, when i do request.POST.get('room_id') or ('id') i'm getting an error Room matching query does not exist.
how to solved this problem? help me 


    class Room(models.Model):
        status = models.BooleanField('Status',default=True)
        name = models.CharField('Name', max_length=100, unique=True)

    class Book(models.Model):
        date = models.DateTimeField('Created',auto_now_add=True)
        from_date = models.DateField('Check-in')
        to_date = models.DateField('Check-out')
        room = models.ForeignKey(Room, related_name='booking')


i need detail room request get id, booked dates range(from_date,to_date)

def room_detail(request,pk):
    room = get_object_or_404(Room,pk=pk)
    if request.method == 'POST':
        form = BookForm(request.POST,room=room)
        if form.is_valid():
            s = form.save(commit=True)          
            s.save()
            return redirect(request.path)
    else:
        form = BookForm()

    #roomid = Room.objects.values('id')
    type = request.POST.get('id') # or get('room_id')
    rooms = Room.objects.get(id=type)

    start_dates = rooms.booking.values_list('from_date',flat=True)
    end_dates = rooms.booking.values_list('to_date',flat=True)
    dates = [start + timedelta(days=i) for start, end in zip(start_dates,end_dates) for i in range((end-start).days+1)]

    c = {}
    c['form'] = form
    return render_to_response('rooms_detail.html',c)

please help me, thanks in advance