reorder user-import csv data

This commit is contained in:
Oskar Hahn 2011-09-05 09:08:12 +02:00
parent c6259d83bb
commit 510cbf8374
2 changed files with 5 additions and 5 deletions

View File

@ -5,7 +5,7 @@
<h1>Import</h1>
<p>{% trans 'Select a CSV file to import participants!' %}</p>
<p>{% trans '(Required comma separated values: <code>last_name, first_name, email, gender, group, type, committee</code>)' %} </p>
<p>{% trans '(Required comma separated values: <code>first_name, last_name, gender, group, type, committee</code>)' %} </p>
<form enctype="multipart/form-data" action="" method="post">{% csrf_token %}
{{ form.as_p }}
<button type="submit">

View File

@ -251,13 +251,13 @@ def user_import(request):
for line in request.FILES['csvfile']:
i += 1
if i > 0:
(last_name, first_name, email, gender, group, type, committee) = line.strip().split(',')
(first_name, last_name, gender, group, type, committee) = line.strip().split(',')
user = User()
user.last_name = last_name
user.first_name = first_name
user.username = gen_username(first_name, last_name)
user.set_password("%s%s" % (user.first_name, user.last_name))
user.email = email
#user.set_password("%s%s" % (user.first_name, user.last_name))
#user.email = email
user.save()
profile = Profile()
profile.user = user