Skip to content

Instantly share code, notes, and snippets.

@marcelor
Created May 14, 2013 06:53
Show Gist options
  • Save marcelor/5574155 to your computer and use it in GitHub Desktop.
Save marcelor/5574155 to your computer and use it in GitHub Desktop.
from apps.polidata.models import Politician
twitter_data = {
"00512": "@PepeSolari",
"00405": "@JAIMETROBO",
"05851": "@AlfredoAsti",
"00161": "@JuanRaFerreira",
"05262": "@dpayss1",
"05137": "@juliocesilveira",
"00197": "@Luisaheber",
"01044": "@jgamorin",
}
for profile_id,twitter_user in twitter_data.items():
try:
politician = Politician.objects.get(profile_id=profile_id)
politician.twitter_user = twitter_user
politician.save()
print 'Updated twitter user %s of %s' % (twitter_user, politician)
except Politician.DoesNotExist:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment