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


Python User.email方法代码示例

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


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

示例1: authorized

# 需要导入模块: from api.models import User [as 别名]
# 或者: from api.models.User import email [as 别名]
def authorized():
    resp = google.authorized_response()
    if resp is None:
        return 'Access denied: reason=%s error=%s' % (
            request.args['error_reason'],
            request.args['error_description']
        )
    session['google_token'] = (resp['access_token'], '')
    me = google.get('userinfo')
    #app.config['userdata'] = me.data
    user = User.query(User.email == me.data['email']).fetch()
    if not user:
        user = User()
        user.name = me.data['name']
        user.email = me.data['email']
        user.thumbnail = me.data['picture']
        user.active = True
        user.authenticated = True
        user.anonymous = True
        user.active = True
        user.put()
    session['user_id'] = me.data['email']
    session['_fresh'] = True
    flash('Logged in successfully.')
    return redirect(urlservice)
开发者ID:dbcaturra,项目名称:bpm-panela,代码行数:27,代码来源:adminauth.py

示例2: login

# 需要导入模块: from api.models import User [as 别名]
# 或者: from api.models.User import email [as 别名]
def login(request):
    try:
        received_json_data = json.loads(request.body)
        u = User(spotify_id=received_json_data['spotifyId'])
        u.account_type = received_json_data['account_type']
        u.user_name = received_json_data["username"]
        u.email = received_json_data["email"]
    except ValueError:
        return HttpResponse("Inavlid Json", status=403)

    if u.last_token_spotify != received_json_data["spotifyToken"]:
        u.last_token_spotify = received_json_data["spotifyToken"]
        if u.check_token_spotify():
            u.save()
            serializer = AccountSerializer(u, many=False)
            return JSONResponse(serializer.data)

    return HttpResponse("Spotify user not valid", status=400)
开发者ID:facundo-rodriguez-17,项目名称:lesbox,代码行数:20,代码来源:views.py

示例3: handle

# 需要导入模块: from api.models import User [as 别名]
# 或者: from api.models.User import email [as 别名]
    def handle(self, *args, **options):

        try:

            contest = Contest.objects.all()
            contest.delete()

            contest_2014 = Contest()
            contest_2014.year = 2014
            contest_2014.theme = 'Ritim'
            contest_2014.poster = 'http://beste.halici.com.tr/afis/2014.jpg'
            contest_2014.start_date = datetime.datetime(2014, 6, 1, 0, 0)
            contest_2014.final_date = datetime.datetime(2014, 11, 1, 0, 0)
            contest_2014.finish_date = datetime.datetime(2014, 12, 15, 0, 0)
            contest_2014.save()

            contest_2015 = Contest()
            contest_2015.year = 2015
            contest_2014.theme='Attila Özdemiroğlu'
            contest_2014.poster = 'http://beste.halici.com.tr/afis/2015.jpg'
            contest_2015.start_date = datetime.datetime(2015, 6, 1, 0, 0)
            contest_2015.final_date = datetime.datetime(2015, 11, 1, 0, 0)
            contest_2015.finish_date = datetime.datetime(2015, 12, 15, 0, 0)
            contest_2015.save()

            devices = Device.objects.all()
            devices.delete()

            device = Device()
            device.name = 'Bilgisayar'
            device.save()

            softwares = Software.objects.all()
            softwares.delete()

            software = Software()
            software.name = 'FL Studio'
            software.save()

            stage_materials = StageMaterial.objects.all()
            stage_materials.delete()

            stage_material = StageMaterial()
            stage_material.name = 'Gitar'
            stage_material.save()

            contents = Content.objects.all()
            contents.delete()

            content_file = open('default_contents/api_content.csv', 'rb')
            reader = csv.reader(content_file)

            for row in reader:
                content = Content()
                content.create_date = row[1]
                content.title = row[2]
                content.link = row[3]
                content.content = row[4]
                content.category_name = row[5]
                content.is_active = True if row[7] == '1' else False
                content.is_for_static_content = True if row[8] == '1' else False

                content.save()

            content_vote=Content()
            content_vote.title = 'Oylama'
            content_vote.link='oylama'
            content_vote.category_name = 'link'
            content_vote.is_active = True
            content_vote.is_for_static_content = False
            content_vote.save()

            users = User.objects.all()
            users.delete()

            user = User()
            user.username = 'karacabey'
            user.email = '[email protected]'
            user.first_name = 'Abdullah'
            user.last_name = 'Karacabey'
            user.set_password('674311')
            user.addres = 'Bağlum'
            user.city = 'Ankara'
            user.save()

            compositions = Composition.objects.all()
            compositions.delete()

            composition_1 = Composition()
            composition_1.owner=user
            composition_1.contest=contest_2014
            composition_1.name = 'İlk Şarkı'
            composition_1.url = 'https://s3-eu-west-1.amazonaws.com/gong-ir/temp_attachments/beste/1441108257899wjzK3Htv'
            composition_1.save()
            composition_1.softwares = [software]
            composition_1.devices = [device]
            composition_1.stage_materials = [stage_material]


            composition_2 = Composition(owner=user, contest=contest_2014)
#.........这里部分代码省略.........
开发者ID:haliciyazilim,项目名称:beste-yarismasi,代码行数:103,代码来源:createContents.py


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