1👍
✅
approved = PDFStat.objects.filter(quote_num=order).values_list('sales_approved', flat=True)
This will return a values queryset e.g. [True,]
. Comparing it to True
will always return False.
Perhaps you want something like:
pdf_stat = PDFStat.objects.get(quote_num=order)
approved = pdf_stat.sales_approved
Note you may need extra code to handle the case when there are no rows or multiple rows that match the get()
.
0👍
messages.error(requet, order + ' has already been approved by Sales').
'requet' should be 'request'
.
String concatenate should be.
messages.error(request, '{0} has already been approved by Sales'.format(order)).
Source:stackexchange.com