Skip to content

Instantly share code, notes, and snippets.

@vanatteveldt
Created October 23, 2013 08:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vanatteveldt/7114409 to your computer and use it in GitHub Desktop.
Save vanatteveldt/7114409 to your computer and use it in GitHub Desktop.
from amcat.models import Article
import csv, sys
for line in csv.DictReader(sys.stdin, delimiter=';'):
aid = int(line["Article ID"])
mid = int(line["New Medium ID"])
print aid, "->", mid
a = Article.objects.get(pk=aid)
a.medium_id = mid
a.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment