Skip to content

Commit

Permalink
fix print for python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerard Casas Saez committed Oct 12, 2017
1 parent fe955a7 commit c67f62b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions checkin/management/commands/add_volunteers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import print_function

import csv
import sys

Expand Down Expand Up @@ -31,19 +33,19 @@ def handle(self, *args, **options):
user = User.objects.filter(email=email).first()

if not user:
print 'Creating user {0}.'.format(email)
print('Creating user {0}.'.format(email))
user = User.objects.create_user(username=username, email=email)
user.set_password(password)
else:
print 'Updating permissions for user {0}.'.format(email)
print('Updating permissions for user {0}.'.format(email))

checkin_perm = Permission.objects.get(codename='check_in')
user.user_permissions.add(checkin_perm)
user.save()
assert authenticate(username=username, password=password)

print 'User {0} successfully created.'.format(email)
print('User {0} successfully created.'.format(email))

except:
print 'There was a problem creating the user: {0}. Error: {1}.' \
.format(email, sys.exc_info()[1])
print('There was a problem creating the user: {0}. Error: {1}.'
.format(email, sys.exc_info()[1]))

0 comments on commit c67f62b

Please sign in to comment.