def bulk_create(request): """bulk create the users from the upload.""" if request.method == "POST": if 'csvfile' in request.FILES: total_load = bulk_create_players(request.FILES['csvfile']) messages.success(request, "Total user created: %d" % total_load) return HttpResponseRedirect("/admin/auth/user/")
def handle(self, *args, **options): """Load and create the users from a csv file containing team, name, and email.""" if len(args) == 0: self.stdout.write("the csv file name missing.\n") return filename = args[0] try: infile = open(filename) except IOError: self.stdout.write("Can not open the file: %s , Aborting.\n" % (filename)) return load_count = player_mgr.bulk_create_players(infile) infile.close() print "---- total loaded: %d" % (load_count)
def handle(self, *args, **options): """Load and create the users from a csv file containing team, name, and email.""" if len(args) == 0: self.stdout.write("the csv file name missing.\n") return filename = args[0] try: infile = open(filename) except IOError: self.stdout.write( "Can not open the file: %s , Aborting.\n" % (filename)) return load_count = player_mgr.bulk_create_players(infile) infile.close() print "---- total loaded: %d" % (load_count)