The following works for me —
email_list = EmailList.objects.get(domain=(cd['email'].split('@')[1]))
But defining the ‘domain’ variable before does not —
domain = cd['email'].split('@')[1]
email_list = EmailList.objects.get(domain=domain)
When I do the latter, it raises an "EmailList matching query does not exist". What accounts for this difference??
There is nothing that accounts for this difference; Python variables do not change type when bound to a name.