当前位置: 首页>>代码示例>>Python>>正文


Python User.last_name方法代码示例

本文整理汇总了Python中mongoengine.django.auth.User.last_name方法的典型用法代码示例。如果您正苦于以下问题:Python User.last_name方法的具体用法?Python User.last_name怎么用?Python User.last_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mongoengine.django.auth.User的用法示例。


在下文中一共展示了User.last_name方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: index

# 需要导入模块: from mongoengine.django.auth import User [as 别名]
# 或者: from mongoengine.django.auth.User import last_name [as 别名]
def index(request):
	firstname = "";
	lastname = "";
	username = "";
	password = "";
	email = "";
	if request.method == 'GET':
		return render(request, 'myapp/signup.html', {'rangerDay':range(1,32),'rangerYear':range(2014,1905,-1),})
	elif request.method == 'POST':
		firstname = request.POST['txtFirstName']
		lastname = request.POST['txtLastName']
		username = request.POST['txtUserName']
		password = request.POST['txtPassWord']
		email= request.POST['txtEmail']
		try:
			user = User()
			user.username = username
			user.first_name = firstname
			user.last_name = lastname
			user.email = email
			user.set_password(password);
			user.save()
			
			_profile = UserProfile()
			_profile.user_id = user
			_profile.save()
			
			user.backend = 'mongoengine.django.auth.MongoEngineBackend'
			logout(request)
			login(request, user)
			return HttpResponseRedirect('/mainscreen')
		except mongoengine.errors.NotUniqueError as e:
				return getSignupError(request,'Đã tồn tại trong hệ thống',firstname,lastname,username,password,email)
开发者ID:cuongnmfis,项目名称:dms,代码行数:35,代码来源:SignUp.py

示例2: handle

# 需要导入模块: from mongoengine.django.auth import User [as 别名]
# 或者: from mongoengine.django.auth.User import last_name [as 别名]
    def handle(self, **kwargs):
        while True:
            username = self._get_string('Username')
        
            if User.objects(username=username).count() > 0:
                print "That username is already in use"
                continue
            else:
                break
        
        while True:
            email = self._get_string('Email', required=False)
        
            if User.objects(email=email).count() > 0:
                print "That email is already in use"
                continue
            else:
                break
            
        password = self._get_string('Password', getpass.getpass)
        first_name = self._get_string('First name')
        last_name = self._get_string('Last name')

        u = User(username=username)
        u.first_name = first_name
        u.last_name = last_name
        u.email = email
        u.set_password(password)
        u.is_staff = True
        u.is_superuser = False
        u.save()

        print 'User "%s %s" successfully added' % (first_name, last_name)
开发者ID:mzupan,项目名称:intake,代码行数:35,代码来源:adduser.py

示例3: index

# 需要导入模块: from mongoengine.django.auth import User [as 别名]
# 或者: from mongoengine.django.auth.User import last_name [as 别名]
def index(request):
	firstname = "";
	lastname = "";
	username = "";
	password = "";
	email = "";
	if request.method == 'GET':
		return render(request, 'myapp/signup.html', {'rangerDay':range(1,32),'rangerYear':range(2014,1905,-1),})
	elif request.method == 'POST':
		try:
			#parameter
			firstname = request.POST['txtFirstName']
			lastname = request.POST['txtLastName']
			username = request.POST['txtUserName']
			password = request.POST['txtPassWord']
			email= request.POST['txtEmail']
			if str(firstname).strip() == "":
				return getSignupError(request,'First name can not be empty!',firstname,lastname,username,password,email)
			elif str(lastname).strip() == "":
				return getSignupError(request,'Last name can not be empty!',firstname,lastname,username,password,email)
			elif str(username).strip() == "":
				return getSignupError(request,'User name can not be empty!',firstname,lastname,username,password,email)
			elif str(password).strip() == "":
				return getSignupError(request,'Pass word can not be empty!',firstname,lastname,username,password,email)
			elif str(email).strip() == "":
				return getSignupError(request,'Email can not be empty!',firstname,lastname,username,email)
			#insert new user
			user = User()
			user.username = username
			user.first_name = firstname
			user.last_name = lastname
			user.email = email
			user.set_password(password);
			user.save()
			user.backend = 'mongoengine.django.auth.MongoEngineBackend'
			logout(request)
			login(request, user)
			#create new profile
			_profile = UserProfile()
			_profile.user_id = request.user
			_profile.save()
			return HttpResponseRedirect('/home')
		except mongoengine.errors.ValidationError as ex:
			return getSignupError(request,str(ex.errors['email']),firstname,lastname,username,password,email)
		except mongoengine.errors.NotUniqueError as e:
			return getSignupError(request,'User has already exists!',firstname,lastname,username,password,email)
		except Exception as e:
			return getSignupError(request,str(e),firstname,lastname,username,password,email)
开发者ID:cuongnmeas,项目名称:ase,代码行数:50,代码来源:SignUp.py

示例4: handle

# 需要导入模块: from mongoengine.django.auth import User [as 别名]
# 或者: from mongoengine.django.auth.User import last_name [as 别名]
    def handle(self, **kwargs):
        username = self._get_string('Username')
        email = self._get_string('Email', required=False)
        password = self._get_string('Password', getpass.getpass)
        first_name = self._get_string('First name')
        last_name = self._get_string('Last name')

        user = User(username=username)
        user.first_name = first_name
        user.last_name = last_name
        user.email = email
        user.set_password(password)
        user.is_staff = True
        user.save()

        print 'User "%s %s" successfully added' % (first_name, last_name)
开发者ID:mattupstate,项目名称:what-if,代码行数:18,代码来源:adduser.py

示例5: index

# 需要导入模块: from mongoengine.django.auth import User [as 别名]
# 或者: from mongoengine.django.auth.User import last_name [as 别名]
def index(request):
	if request.method == 'GET':
		context={}
		return render(request, 'myapp/d-NewCus.html', context)
	elif request.method == 'POST':
		firstname = request.POST['txtFirstName']
		lastname = request.POST['txtLastName']
		idNo = request.POST['txtidNo']
		Address = request.POST['txtAddress']
		HomeAddress = request.POST['txtHomeAddress']
		PhoneNumber = request.POST['txtPhoneNumber']
		About = request.POST['txaAbout']

		try:
			user_name='student'
			debt_owner=User.objects.get(username=user_name)
			
			user = User()
			user.username = firstname + lastname
			user.first_name = firstname
			user.last_name = lastname
			user.set_password(idNo);
			user.save()
			
			_customer = Customer()
			_customer.cus_id = user
			_customer.id_no = idNo
			_customer.cus_code=firstname
			_customer.address = Address
			_customer.home_address = HomeAddress
			_customer.fone_number = PhoneNumber
			_customer.about = About
			_customer.status = 1
			_customer.debt_owner = debt_owner
			_customer.save()
			
			user.backend = 'mongoengine.django.auth.MongoEngineBackend'
			context={"status":"success"}
			return render(request, 'myapp/d-mainScreen.html', context)
		except Exception as e:
			print(e)
开发者ID:ngotuan12,项目名称:ASEProject,代码行数:43,代码来源:d_NewCus.py

示例6: MongoUser

# 需要导入模块: from mongoengine.django.auth import User [as 别名]
# 或者: from mongoengine.django.auth.User import last_name [as 别名]
from Sponitor.stats import models as sql, mongoModels as mongo

parser = argparse.ArgumentParser(description='Convert django model from SQL model to MongoDB model')
parser.add_argument('--all', dest='all', action='store_true', help='convert every models')
parser.add_argument('--models', '-m', dest='models', nargs='*', help='convert specified models')
arguments = parser.parse_args()

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
开发者ID:,项目名称:,代码行数:33,代码来源:


注:本文中的mongoengine.django.auth.User.last_name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。