on line 12 you would need a more complex logic
try:
obj = SocialAccount.objects.get(social_profile=profile, service=service, value__iexact=value)
except SocialAccount.DoesNotExist:
obj = SocialAccount.objects.create(social_profile=profile, service=service, value=value)
(assuming "value" is the case insensitive field)
A little more permanent solution would be to always store the value in lowercase and make all the queries using lowercase values, as the solution above only prevents the bug in this method.