comparison gpp/legacy/management/commands/import_old_download_comments.py @ 535:4021ea1045f7

Adding import commands for the 1.0 POTD & comments.
author Brian Neal <bgneal@gmail.com>
date Sat, 31 Dec 2011 21:34:17 +0000
parents 639cfdf59167
children
comparison
equal deleted inserted replaced
534:98f5facc0030 535:4021ea1045f7
57 return 57 return
58 58
59 try: 59 try:
60 user = User.objects.get(username=row['ratinguser']) 60 user = User.objects.get(username=row['ratinguser'])
61 except User.DoesNotExist: 61 except User.DoesNotExist:
62 old_name = row['ratinguser'].lower()
62 try: 63 try:
63 user = User.objects.get( 64 user = User.objects.get(
64 username=legacy.data.KNOWN_USERNAME_CHANGES[row['ratinguser']]) 65 username=legacy.data.KNOWN_USERNAME_CHANGES[old_name])
65 except (User.DoesNotExist, KeyError): 66 except (User.DoesNotExist, KeyError):
66 return 67 return
67 68
68 vote_date = datetime.strptime(row['ratingtimestamp'], "%Y-%m-%d %H:%M:%S") 69 vote_date = datetime.strptime(row['ratingtimestamp'], "%Y-%m-%d %H:%M:%S")
69 70