1👍
✅
SELECT script_fail, stb_role FROM results_tests_codes
WHERE results_test_id = 10787
AND script_fail = 1 AND stb_role = "M"
results = ResultsTestsCodes.objects.filter(results_test_id=10787, script_fail=1, stb_role='M').values('script_fail', 'stb_role')
and
SELECT script_fail, stb_role FROM results_tests_codes
WHERE results_test_id = 10787
AND script_fail = 1 AND stb_role = "G"
results = ResultsTestsCodes.objects.filter(results_test_id=10787, script_fail=1, stb_role='G').values('script_fail', 'stb_role')
Then you can access script_fail
and stb_role
like this:
for result in results:
print(result.get('script_fail'))
print(result.get('stb_role'))
Is that what you’re looking for?
Source:stackexchange.com