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


Python Photo.all方法代码示例

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


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

示例1: __init__

# 需要导入模块: from models import Photo [as 别名]
# 或者: from models.Photo import all [as 别名]
 def __init__(self):
     t = datetime.datetime.now() - datetime.timedelta(hours=4)
     s = Subject().get_current().key().id()
     for img in (
         Photo.all().filter("subject_id =", s).filter("is_blocked =", False).filter("date_updated <", t).fetch(10)
     ):
         self.fetch_img(img.instagram_id)
开发者ID:yezooz,项目名称:instadaily-backend-appengine,代码行数:9,代码来源:photo_update.py

示例2: refresh_gallery

# 需要导入模块: from models import Photo [as 别名]
# 或者: from models.Photo import all [as 别名]
 def refresh_gallery(self):
     from util import render_template
     xml = render_template('gallery2.xml', photos=Photo.all())
     memcache.set("gallery.xml", xml) #@UndefinedVariable
     return webapp2.Response(xml, content_type='application/xml')
 
                    
开发者ID:ppalucki,项目名称:shcms,代码行数:7,代码来源:dynamic.py

示例3: list_files

# 需要导入模块: from models import Photo [as 别名]
# 或者: from models.Photo import all [as 别名]
def list_files():
    logger.debug('list files')
    photos = Photo.all()
    logger.debug(photos)
    context = {'photos': photos}
    template = j2env.get_template('templates/list.html')
    return template.render(context)
开发者ID:ashimali,项目名称:baltipic,代码行数:9,代码来源:main.py

示例4: show_public_photo

# 需要导入模块: from models import Photo [as 别名]
# 或者: from models.Photo import all [as 别名]
def show_public_photo(request, key):
    extra_context = {
        'object_list': Thumbnail.all().order('-photo_date_added'),
        'viewed_username': 'public',
    }
    return object_detail(request, Photo.all(), key,
        template_name='photo/public-show.html',
        template_object_name='photo',
        extra_context=extra_context)
开发者ID:heracek,项目名称:quadanimr,代码行数:11,代码来源:views.py

示例5: get

# 需要导入模块: from models import Photo [as 别名]
# 或者: from models.Photo import all [as 别名]
    def get(self, *args, **kwargs):
        last_50 = Photo.all().filter('is_active =', True).filter('is_user_active =', True).filter('is_blocked =',
                                                                                                  False).order(
            '-date_added').fetch(limit=20)

        i = 0
        last_50 = [p for p in last_50]
        photos = []
        for x in xrange(0, len(last_50) / 2):
            photos.append([last_50[i], last_50[i + 1]])
            i += 2

        self.render(os.path.join(os.path.dirname(__file__), 'templates/index.html'), photos=photos, submitted=False)
开发者ID:yezooz,项目名称:instadaily-backend-appengine,代码行数:15,代码来源:views.py

示例6: get

# 需要导入模块: from models import Photo [as 别名]
# 或者: from models.Photo import all [as 别名]
    def get(self, subject_id, username):
        photos = []
        for photo in (
            Photo.all()
            .filter("user =", username)
            .filter("subject_id =", int(subject_id))
            .filter("is_active =", True)
            .filter("is_user_active =", True)
            .filter("is_blocked =", False)
            .order("-total_score")
        ):
            photos.append(photo.to_dict())

        self.response.out.write(json.dumps({"photos": photos}))
开发者ID:yezooz,项目名称:instadaily-backend-appengine,代码行数:16,代码来源:methods.py

示例7: users_page

# 需要导入模块: from models import Photo [as 别名]
# 或者: from models.Photo import all [as 别名]
def users_page(request, username):
    viewed_user = User.get_user_by_username_or_404(username)
    
    photo = None
    fetched_photo_list = Photo.all().filter('user', viewed_user).order('-date_added').fetch(1)
    if fetched_photo_list:
        photo = fetched_photo_list[0]
    
    extra_context = {
        'viewed_user': viewed_user,
        'photo': photo,
        'viewed_username': username
    }
    
    return object_list(request,
        queryset=Thumbnail.all().filter('photo_user', viewed_user).order('-photo_date_added'),
        template_name='photo/show.html',
        extra_context=extra_context
    )
开发者ID:heracek,项目名称:quadanimr,代码行数:21,代码来源:views.py

示例8: get

# 需要导入模块: from models import Photo [as 别名]
# 或者: from models.Photo import all [as 别名]
 def get(self):
     photo_list = Photo.all().order('-updated_at')
     template_vars = { 'object_list': photo_list }
     self.render_response('photo/photo_list.html', template_vars)
开发者ID:takatoshiono,项目名称:chin-ma-ya.org,代码行数:6,代码来源:photo.py


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