本文整理汇总了Python中mongoengine.django.auth.User.date_joined方法的典型用法代码示例。如果您正苦于以下问题:Python User.date_joined方法的具体用法?Python User.date_joined怎么用?Python User.date_joined使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mongoengine.django.auth.User
的用法示例。
在下文中一共展示了User.date_joined方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_user
# 需要导入模块: from mongoengine.django.auth import User [as 别名]
# 或者: from mongoengine.django.auth.User import date_joined [as 别名]
def create_user(username, password, group, telphone = None, email=None, is_staff=True, is_active=True, is_superuser=False):
now = datetime.datetime.now()
if email is not None:
try:
email_name, domain_part = email.strip().split('@', 1)
except ValueError:
pass
else:
email = '@'.join([email_name, domain_part.lower()])
user = User()
user.username = username
user.password = make_password(password)
user.group = group
user.email = email
user.telphone = telphone
user.is_staff = is_staff
user.is_active = is_active
user.is_superuser = is_superuser
user.date_joined = now
user.save()
return user
示例2: MongoUser
# 需要导入模块: from mongoengine.django.auth import User [as 别名]
# 或者: from mongoengine.django.auth.User import date_joined [as 别名]
i = 0
# User
if arguments.all or 'User' in arguments.models:
for sqlRow in DjangoUser.objects.all():
mongoRow = MongoUser()
mongoRow.username = sqlRow.username
mongoRow.first_name = sqlRow.first_name
mongoRow.last_name = sqlRow.last_name
mongoRow.email = sqlRow.email
mongoRow.password = sqlRow.password
mongoRow.is_staff = sqlRow.is_staff
mongoRow.is_active = sqlRow.is_active
mongoRow.is_superuser = sqlRow.is_superuser
mongoRow.last_login = sqlRow.last_login
mongoRow.date_joined = sqlRow.date_joined
mongoRow.save()
i += 1
print "User" + str(i)
i = 0
# EndGame
if arguments.all or 'EndGame' in arguments.models:
for sqlRow in sql.EndGame.objects.all():
mongoRow = mongo.EndGame()
mongoRow.version = sqlRow.version
mongoRow.winner = sqlRow.winner