Commit 2ec810f0 authored by Kedar Aitawdekar's avatar Kedar Aitawdekar 💻

updated doc/deployer/ to...

updated doc/deployer/ to take email_id from username field
parent 507fb116
import os
import csv
import time
import re
from bson import ObjectId
from django.contrib.auth.models import User
from gnowsys_ndf.settings import GSTUDIO_LOGS_DIR_PATH
from gnowsys_ndf.ndf.models import Author, node_collection
if not os.path.isdir(GSTUDIO_LOGS_DIR_PATH):
auth_gst ={'_type': u'GSystemType', 'name': u'Author'})
auth_gst_id = auth_gst._id
......@@ -23,12 +24,22 @@ if os.path.exists(file_input):
with open(file_input, 'rb') as csvfile:
users = csv.reader(csvfile, delimiter=';')
for school_code, username, password in users:
# email validation from username
email = ''
match = re.match('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$', username)
if match:
email = username
temp_csv_log_list = [school_code, username, password]
user_obj = User.objects.create_user(username=username, password=password)
user_obj = User.objects.create_user(username=username, email=email, password=password)
user_id =
auth = node_collection.collection.Author()
auth['name'] = unicode(username)
auth['email'] = unicode(email)
auth['member_of'] = [auth_gst_id]
auth['group_type'] = u"PUBLIC"
auth['edit_policy'] = u"NON_EDITABLE"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment