def import_users():
Profile.objects.all().delete()
for row in db.iterate_table('users', 100):
user = Profile()
map = ('id=@, username=login, first_name=title, email=@'
',date_joined=createDate, website=homesite, contact=@'
',contact_type=@, date_joind=createDate, sex=@'
',notify_hits_now=@, notify_hits_2day=@, notify_hits_week=@'
',city_count=beenCitiesCounter, country_count=beenCountriesCounter'
',uid=@, thank_count=thanksCounter'
',question_count=questionsCounter, answer_count=answersCounter'
',question_notified=qnotified, comment_notify=@'
',question_notify=@, favourite_notify=favorites_notify'
)
converters = {
'first_name': not_null, 'website': not_null, 'contact': not_null,
'contact_type': contact_type_handler,
'sex': sex_handler,
'comment_notify': comment_notify_handler,
'favourite_notify': favourite_notify_handler,
'question_notify': question_notify_handler,
}
bulk_assign(user, row, map, converters)
user.save()
for key, XXX in parse_map_string(map):
print u'%s: %s' % (key, getattr(user, key))
p = Profile(username='****', is_superuser=True, is_staff=True)
p.set_password('****')
p.save()