ctx['location_ids'] = vals['location_ids']
I have a large function so I will not post it here, but the problem is when vals['location_ids'] have values as integer everything works smooth, but sometimes there are no values in vals['location_ids'] so it is False, and when it is False I get error.
ctx['location_ids'] = vals['location_ids']
TypeError: 'bool' object has no attribute '__getitem__'
how can I avoid it, maybe add hasattr?