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


Python Profile.all方法代码示例

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


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

示例1: post

# 需要导入模块: from models import Profile [as 别名]
# 或者: from models.Profile import all [as 别名]
 def post(self):
     form = ProfileForm(data=self.request.POST)
     if form.is_valid():
         user = users.get_current_user()
         username = self.request.get('username')
         #profile = Profile.all().filter('user !=', user).filter('username =', username).get()
         profile = Profile.all().filter('username =', username).get()
         if profile and profile.user != user:
             errors = { 'username_exists': ['%s is already exists'] }
             profile = { 'username': username }
             template_vars = { 'errors': errors, 'profile': profile }
             self.render_response('profile/profile_edit.html', template_vars)
         else:
             profile = Profile.all().filter('user =', user).get()
             if profile:
                 profile.username = username
             else:
                 profile = Profile(user = user,
                                   username = username,
                                   )
             profile.put()
             self.redirect('/profile')
     else:
         template_vars = { 'form': form }
         self.render_response('profile/profile_edit.html', template_vars)
开发者ID:takatoshiono,项目名称:chin-ma-ya.org,代码行数:27,代码来源:profile.py

示例2: get

# 需要导入模块: from models import Profile [as 别名]
# 或者: from models.Profile import all [as 别名]
 def get(self):
     user = users.get_current_user()
     if user:
         profile = Profile.all().filter('user =', user).get()
         template_vars = { 'profile': profile }
         self.render_response('profile/profile_detail.html', template_vars)
     else:
         self.redirect('/')
开发者ID:takatoshiono,项目名称:chin-ma-ya.org,代码行数:10,代码来源:profile.py

示例3: get

# 需要导入模块: from models import Profile [as 别名]
# 或者: from models.Profile import all [as 别名]
 def get(self):
     self.validate()
     
     profiles_query = Profile.all()
     profiles_query.order('last_name')
     self.values['profiles'] = profiles_query.fetch(100)    
     # TODO: Figure out paging
     
     self.output('user_list.html')
开发者ID:JeanCSM,项目名称:quizzical,代码行数:11,代码来源:edit.py

示例4: post

# 需要导入模块: from models import Profile [as 别名]
# 或者: from models.Profile import all [as 别名]
 def post(self, *args):
     name = self.request.get('name')
     prof = Profile.all().filter('user = ',users.get_current_user()).get()
     if not prof:
         prof = Profile(name=name)
     else:
         prof.name = name
     avatar = self.request.get('avatar')
     avatar = images.resize(avatar,32,32)
     prof.avatar = db.Blob(avatar)
     prof.put()
     self.redirect('/')
开发者ID:yanzay,项目名称:pagankolo,代码行数:14,代码来源:main.py

示例5: GET

# 需要导入模块: from models import Profile [as 别名]
# 或者: from models.Profile import all [as 别名]
    def GET(self, name=None):
        if auth.is_admin():
            found_name = False
            if name:
               q = Profile.all().filter('uid =', name).get()
               if q:
                  found_name = True
                  return self.individual_profile(q)

            if not found_name:
                results = dict()
                for profile in db.GqlQuery("SELECT * FROM Profile"):
                    results[profile.uid] = profile
                for l in db.GqlQuery("SELECT * FROM LastOnline"):
                    if l.uid in results:
                        results[l.uid].last_online = l.last_online
                return super(self.__class__, self).GET({'students' : results})
        else:
          return "Access Denied!"
开发者ID:kourge,项目名称:accepted,代码行数:21,代码来源:listcontroller.py

示例6: prompt

# 需要导入模块: from models import Profile [as 别名]
# 或者: from models.Profile import all [as 别名]
def prompt():
    sent_count = 0
    for profile in Profile.all():
        try:
            if profile.prompt_now:
                mail.send_mail(sender=ADMIN_EMAIL,
                    to=profile.user.email(),
                    subject="[workjournal] Daily prompt",
                    body="""
Hello!

Take a moment to visit this URL and jot down what you did today:

{0}?edit

Thanks, have a good day!

""".format(request.url_root))
                sent_count += 1
        except Exception, e:
            logging.error(str(e))
开发者ID:progrium,项目名称:workjournal,代码行数:23,代码来源:main.py

示例7: get

# 需要导入模块: from models import Profile [as 别名]
# 或者: from models.Profile import all [as 别名]
    def get(self):

        user = users.get_current_user()
        profile = Profile.all().filter('owner = ', user).get()

        td = default_template_data()
        td["credentials_selected"] = True
        td["consumer_key"] = settings.CONSUMER_KEY
        td["consumer_secret"] = settings.CONSUMER_SECRET

        if os.environ['SERVER_SOFTWARE'].startswith('Development'):
            td["authorized"] = True
            td["oauth_token"] = "ACCESS_TOKEN"
            td["oauth_token_secret"] = "ACCESS_TOKEN_SECRET"
        elif profile:
            td["authorized"] = True
            td["oauth_token"] = profile.token
            td["oauth_token_secret"] = profile.secret
        else:
            td["authorized"] = False

        self.render(td, 'admin/credentials.html')
        return
开发者ID:Homefinder,项目名称:stashboard,代码行数:25,代码来源:admin.py

示例8: digest

# 需要导入模块: from models import Profile [as 别名]
# 或者: from models.Profile import all [as 别名]
def digest():
    sent_count = 0
    for profile in Profile.all():
        try:
            if profile.digest_now:
                send_digest = False
                body = "Hello! Here's what your team is up to:\n\n"
                for p in profile.following:
                    entry = p.entry_yesterday
                    if entry:
                        send_digest = True
                        body += "## {0}\n\n{1}\n\n".format(
                            p.username, entry.summary)
                        if entry.details:
                            body += "More details: {0}{1}\n\n".format(
                                request.url_root, p.username)
                if send_digest:
                    mail.send_mail(sender=ADMIN_EMAIL,
                        to=profile.user.email(),
                        subject="[workjournal] Daily digest",
                        body=body)
                    sent_count += 1
        except Exception, e:
            logging.error(str(e))
开发者ID:progrium,项目名称:workjournal,代码行数:26,代码来源:main.py

示例9: get

# 需要导入模块: from models import Profile [as 别名]
# 或者: from models.Profile import all [as 别名]
    def get(self):

        consumer_key = 'anonymous'
        consumer_secret = 'anonymous'

        td = default_template_data()
        td["logged_in"] = False
        td["credentials_selected"] = True
        td["consumer_key"] = consumer_key

        user = users.get_current_user()

        if user:

            td["logged_in"] = users.is_current_user_admin()
            profile = Profile.all().filter('owner = ', user).get()

            if profile:

                td["user_is_authorized"] = True
                td["profile"] = profile

            else:

                host = self.request.headers.get('host', 'nohost')

                callback = 'http://%s/documentation/verify' % host

                request_token_url = 'https://%s/_ah/OAuthGetRequestToken?oauth_callback=%s' % (host, callback)
                authorize_url = 'https://%s/_ah/OAuthAuthorizeToken' % host

                consumer = oauth.Consumer(consumer_key, consumer_secret)
                client = oauth.Client(consumer)

                # Step 1: Get a request token. This is a temporary token that is used for
                # having the user authorize an access token and to sign the request to obtain
                # said access token.

                td["user_is_authorized"] = False

                if "localhost" not in host:

                    resp, content = client.request(request_token_url, "GET")

                    if resp['status'] == '200':

                        request_token = dict(cgi.parse_qsl(content))

                        authr = AuthRequest.all().filter("owner =", user).get()

                        if authr:
                            authr.request_secret = request_token['oauth_token_secret']
                        else:
                            authr = AuthRequest(owner=user,
                                    request_secret=request_token['oauth_token_secret'])

                        authr.put()

                        td["oauth_url"] = "%s?oauth_token=%s" % (authorize_url, request_token['oauth_token'])

        self.render(td, 'credentials.html')
开发者ID:kyleconroy,项目名称:stashboard,代码行数:63,代码来源:site.py

示例10: get

# 需要导入模块: from models import Profile [as 别名]
# 或者: from models.Profile import all [as 别名]
 def get(self):
     """Simply returns a Response object with an enigmatic salutation."""
     c = Profile.all().count()
     return self.render_response('index.html', form=self.form, c=c)
开发者ID:barraponto,项目名称:rhok-bush-appengine,代码行数:6,代码来源:handlers.py

示例11: getProfile

# 需要导入模块: from models import Profile [as 别名]
# 或者: from models.Profile import all [as 别名]
 def getProfile(self, user):
     return Profile.all().filter('user = ', user).get()
开发者ID:yanzay,项目名称:pagankolo,代码行数:4,代码来源:main.py

示例12: getCurrentUserName

# 需要导入模块: from models import Profile [as 别名]
# 或者: from models.Profile import all [as 别名]
 def getCurrentUserName(self):
     user = users.get_current_user()
     prof = Profile.all().filter('user = ', user).get()
     if prof:
         return prof.name
     return None
开发者ID:yanzay,项目名称:pagankolo,代码行数:8,代码来源:main.py

示例13: getUserNameAndID

# 需要导入模块: from models import Profile [as 别名]
# 或者: from models.Profile import all [as 别名]
 def getUserNameAndID(self,user):
     prof = Profile.all().filter('user = ', user).get()
     if prof:
         return prof.name, prof.key()
     return None, None
开发者ID:yanzay,项目名称:pagankolo,代码行数:7,代码来源:main.py

示例14: get

# 需要导入模块: from models import Profile [as 别名]
# 或者: from models.Profile import all [as 别名]
 def get(self):
     prof = Profile.all().filter('user = ',users.get_current_user()).get()
     self.templ_vals.update({
         'profile':prof
     })
     self.render_to_response('edit_profile.html',self.templ_vals)
开发者ID:yanzay,项目名称:pagankolo,代码行数:8,代码来源:main.py


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