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


Python Account.email方法代码示例

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


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

示例1: create

# 需要导入模块: from models import Account [as 别名]
# 或者: from models.Account import email [as 别名]
def create(request):
    if request.method == 'POST':
        # save new account
        name = request.POST['name']
        username = request.POST['username']
        password = request.POST['password']
        email = request.POST['email']

        account = Account()
        account.name = name
        account.username = username
        account.password = password
        account.email = email
        account.perfil = 'N'
        account.save()
      
        return HttpResponseRedirect(reverse('account-login'))
    
    return render_to_response('account/account_create.html',{'request':request},
                              context_instance=RequestContext(request))
开发者ID:PauloDuarte43,项目名称:tomada-social,代码行数:22,代码来源:views.py

示例2: addUser

# 需要导入模块: from models import Account [as 别名]
# 或者: from models.Account import email [as 别名]
def addUser(request):
	'''
	takes in user information and adds it to the database
	upload images as files in your post request
	:param request:
	:return: nothing
	'''
	username = request.POST.get('username', '')
	password = request.POST.get('password', '')
	user = Account()
	user.first_name = request.POST.get('first_name', '')
	user.last_name = request.POST.get('last_name', '')
	user.email = request.POST.get('email', '')
	user.username = username
	user.about_me = request.POST.get('about_me', '')
	user.password = password
	user.profile_image = request.FILES.get('profile')
	user.cover_image = request.FILES.get('cover')
	#create user secret key
	m = hashlib.md5()

	user.friends = json.dumps(request.POST.get('friends', [])) #list of usernames
	user.history = json.dumps(request.POST.get('history', [])) #list of civi's visited
	user.awards = json.dumps(request.POST.get('awards', [])) #list of user awards


	m.update("{username}{password}{int}".format(username=user.username, password=password, int=random.randint(0, sys.maxint)))
	secret_key = m.hexdigest()
	user.secret_key= secret_key
	user.save()
	try:
		user.save()
	except Exception as e:
		return JsonResponse({'result': e})

	return JsonResponse({'status': 200, 'result': user.secret_key})
开发者ID:pscheid2,项目名称:civiwiki.org,代码行数:38,代码来源:views_read.py

示例3: Class

# 需要导入模块: from models import Account [as 别名]
# 或者: from models.Account import email [as 别名]
hacker.game = precursors
hacker.name = "Hacker"
hacker.primary_stat = "intelligence"
hacker.save()

freelancer = Class()
freelancer.game = precursors
freelancer.name = "Freelancer"
freelancer.primary_stat = "charisma"
freelancer.save()

print "Finished Making Classes"


whitelynx = Account()
whitelynx.email = "[email protected]"
whitelynx.real_name = "David H. Bronke"
whitelynx.nickname = "whitelynx"
whitelynx.save()

morgul = Account()
morgul.email = "[email protected]"
morgul.real_name = "Christopher S. Case"
morgul.nickname = "morgul"
morgul.save()

burst = Account()
burst.email = "[email protected]"
burst.real_name = "Travis A. Odom"
burst.nickname = "Burstaholic"
burst.save()
开发者ID:SkewedAspect,项目名称:precursors-server,代码行数:33,代码来源:load_initial_db.py

示例4: create_account

# 需要导入模块: from models import Account [as 别名]
# 或者: from models.Account import email [as 别名]
def create_account(request, account, accountID=None, updateAPI=True):

    accountAlreadyExists = False
    createAPIAccount = True

    if accountID:
        accountObj = Account.objects.get(id=accountID)
        accountAlreadyExists = True
    else:
        try:
            accountObj = Account.objects.get(email=account['email'])
            accountAlreadyExists = True
        except ObjectDoesNotExist:
            accountObj = Account()

    accountObj.first_name = account['first_name']
    accountObj.last_name = account['last_name']
    accountObj.gender = account['gender']

    if account['birth_date'] not in ['', 'None', None]:
        dob = datetime.datetime.strptime(account['birth_date'], '%Y-%m-%d').date()
    else:
        dob = None

    accountObj.birth_date = dob
    accountObj.email = account['email']
    accountObj.street_number = account['street_number']
    accountObj.city = account['city']
    accountObj.zipcode = account['zipcode']
    accountObj.phone = account['phone']
    accountObj.country = account['country']
    accountObj.utm_campaign = account['utm_campaign']
    accountObj.utm_source = account['utm_source']
    accountObj.utm_medium = account['utm_medium']
    accountObj.tr_language = account['tr_language']
    accountObj.tr_input_method = account['tr_input_method']
    accountObj.tr_ip_address = account['tr_ip_address']
    accountObj.lead = account['lead']

    if 'mailing_list' in account:
        accountObj.mailing_list = int(account['mailing_list'])
    else:
        accountObj.mailing_list = int(account['mailing_lists'][0]['resource_uri'].split('/')[3])

    if 'tr_referral_name' in account:
        accountObj.tr_referral = account['tr_referral_name']
    else:
        accountObj.tr_referral = account['tr_referral']['name']

    accountObj.save()

    if updateAPI:
        if accountAlreadyExists:
            createAPIAccount = api_delete_account(accountObj.resource_uri)

        if createAPIAccount:
            api_create_successful, resource_uri = api_create_account(accountObj)
            if api_create_successful:
                accountObj.resource_uri = resource_uri
                accountObj.save()

                if accountAlreadyExists:
                    message = 'Account successfully updated'
                else:
                    message = 'Account successfully created'

                messages.success(request, message)
            else:
                messages.warning(request, 'Account successfully created but the API post failed')
开发者ID:slhodson969,项目名称:TBTest,代码行数:71,代码来源:utils.py


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