2👍
Your solution will introduce a bunch of sources of error/exception. Why not just follow the standard procedure?
country, created = Country.objects.get_or_create(name='myCountryName', code='myCountryCode')
state, created = State.objects.get_or_create(country=country, name='myStateName', code='myStateCode')
Source:stackexchange.com