0
votes

**shipment_booking is my table name.

***i want to check my table filed "ord" value is "yes" or not

****if my "ord"field value "yes" then return "pre-budget" page.

def bkp1(request):
orderv="yes"
allorder=shipment_booking.objects.all()
return render(request, 'bkp1.html')
if request.method=='POST'and 'pbd' in request.POST:
    for shipment_booking in allorder:
        o=shipment_booking.ords
        if orderv==o:
            return render(request, 'Pre-Budget.html')
        else:
            return render(request, 'bkp1.html',{'msg':'Please Add Order Details'})
else:

    return render(request, 'bkp1.html') 
1
At which line is error thrown? Can you pls align your code properly and tell the exact error msg thrown? - Bhagyesh Dudhediya
BTW why a return render(request, 'bkp1.html') in between after allorder? - Bhagyesh Dudhediya
can u post the code where you defined shipment_booking - Faisal Nazik

1 Answers

0
votes

Seems like you are using shipment_booking undefined variable instead of the real Django model name. Your codes should be like

allorder = ShipmentBooking.objects.all()