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


Python Post.gql方法代码示例

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


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

示例1: user

# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import gql [as 别名]
def user():
    user = '[email protected]'
    if user == None:
        flash('User ' + nickname + ' not found.')
        return redirect(url_for('index'))
    posts = Post.gql('WHERE author = :1', user)
    return render_template('user.html', user = user, posts = posts, users = users)
开发者ID:benchisell,项目名称:curate_flask_appengine,代码行数:9,代码来源:views.py

示例2: index

# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import gql [as 别名]
def index(request):
    query = Post.gql("ORDER BY date DESC")
    form = PostForm()
    c = _getClient()
    logging.info(c.thumbnail("/a.jpg"))
    return render_to_response(
        "index.html", {"posts": query.fetch(20), "form": form}, context_instance=RequestContext(request)
    )
开发者ID:donilan,项目名称:study,代码行数:10,代码来源:views.py

示例3: index

# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import gql [as 别名]
def index(request):
  query = Post.gql('ORDER BY date DESC')
  form = GuestbookForm()
  return render_to_response('index.html',
                            {'posts': query.fetch(20),
                             'form': form
                            }
                           )
开发者ID:liseryang,项目名称:openbotlist,代码行数:10,代码来源:views.py

示例4: get_context_data

# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import gql [as 别名]
    def get_context_data(self, *args, **kwargs):

        ctx = super(PostArchive, self).get_context_data(*args, **kwargs)

        page = self.request.GET.get('p', 1)
        year = self.kwargs.get('year', None)
        month = self.kwargs.get('month', None)
        day = self.kwargs.get('day', None)
        msg = ""

        try:
            if day and month and year:
                lower_limit = date(int(year), int(month), int(day))
                upper_limit = lower_limit + relativedelta(days=+1)
                msg = "%s" % datefilter(lower_limit, "jS M Y")
            elif month and year:
                lower_limit = date(int(year), int(month), 1)
                upper_limit = lower_limit + relativedelta(months=+1)
                msg = "%s" % datefilter(lower_limit, "F Y")
            elif year:
                lower_limit = date(int(year), 1, 1)
                upper_limit = lower_limit + relativedelta(years=+1)
                msg = "%s" % year
        except ValueError:
            raise Http404

        if self.request.user.is_authenticated():
            gql = "WHERE post_date >= :1 AND post_date <= :2 ORDER BY post_date DESC"
        else:
            gql = "WHERE is_published = true AND post_date >= :1 AND post_date <= :2 ORDER BY post_date DESC"

        objects = Post.gql(gql, lower_limit, upper_limit)

        pager = Paginator(objects, PAGE_SIZE)
        page_obj = pager.page(page)

        ctx.update({
            'display_message': msg,
            'paginator': pager,
            'page_obj': page_obj,
            'year': year,
            'month': month,
            'day': day
        })

        return ctx
开发者ID:sleepyjames,项目名称:sleepyjames-aeblog,代码行数:48,代码来源:views.py

示例5: index

# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import gql [as 别名]
def index(request):
    query = Post.gql("ORDER BY date DESC")
    form = ReviewForm()
    return render_to_response("index.html", {"posts": query.fetch(20), "form": form})
开发者ID:asavadatti,项目名称:N900apps,代码行数:6,代码来源:views.py

示例6: index

# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import gql [as 别名]
def index(request):
    query = Post.gql('ORDER BY date DESC')
    form = PostForm()
    return render_to_response('index.html',
                              {'posts': query.fetch(20), 'form': form},
                              context_instance=RequestContext(request))
开发者ID:aristiden7o,项目名称:django-on-appengine,代码行数:8,代码来源:views.py

示例7: osdetail

# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import gql [as 别名]
def osdetail(request, book_id):
    q = Post.gql('WHERE osys IN (\'%s\')' % book_id)
    return render_to_response('getbybook.html', {'posts': q.fetch(100)
                            }
                            )
开发者ID:var,项目名称:upeiapp11-v1,代码行数:7,代码来源:views.py

示例8: listall

# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import gql [as 别名]
def listall(request):
  query = Post.gql('ORDER BY created_on DESC')
  return render_to_response('all.html',
                            {'posts': query.fetch(100)
                            }
                           )                          
开发者ID:var,项目名称:upeiapp11-v1,代码行数:8,代码来源:views.py


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