do not import invalid emails, first/last date
This commit is contained in:
parent
e66c72880f
commit
2db127522d
1 changed files with 4 additions and 1 deletions
|
@ -65,6 +65,8 @@ for u in users:
|
||||||
username = u['username'].strip().lower()
|
username = u['username'].strip().lower()
|
||||||
user, created = User.objects.get_or_create(username=username)
|
user, created = User.objects.get_or_create(username=username)
|
||||||
user.email = u['email']
|
user.email = u['email']
|
||||||
|
if not '@' in user.email:
|
||||||
|
user.email = ''
|
||||||
user.password = u['password']
|
user.password = u['password']
|
||||||
user.date_joined = datetime.strptime(u['created'], '%Y-%m-%dT%H:%M:%SZ')
|
user.date_joined = datetime.strptime(u['created'], '%Y-%m-%dT%H:%M:%SZ')
|
||||||
user.save()
|
user.save()
|
||||||
|
@ -78,7 +80,8 @@ for u in users:
|
||||||
s = SessionData()
|
s = SessionData()
|
||||||
s.user = user
|
s.user = user
|
||||||
s.session_key = hashlib.sha1(user.username).hexdigest()
|
s.session_key = hashlib.sha1(user.username).hexdigest()
|
||||||
s.firstseen = s.lastseen = user.date_joined
|
s.lastseen = user.date_joined
|
||||||
|
s.firstseen = user.date_joined
|
||||||
s.timesseen = 1
|
s.timesseen = 1
|
||||||
s.save()
|
s.save()
|
||||||
for g in u['groups']:
|
for g in u['groups']:
|
||||||
|
|
Loading…
Reference in a new issue