Beispiel #1
0
def list(request, jots):
    try:
        page = int(request.GET['page'])
    except:
        page = 1  
    paginator = utils.createPaginator(page=page)
    for jot in jots:
        if jot.tags and jot.tags[0] != 'photo':
            jot.what = utils.strip_tags(jot.what)[:200] + "..."
    recent_posts = Jot.all().order('-when').fetch(RECENT_POST_SIZE, 0)
    recent_comments = Comment.all().order('-when').fetch(RECENT_POST_SIZE, 0)
    read_most = Jot.all().order('-read_num').fetch(RECENT_POST_SIZE, 0)
    return render_to_response('index.html', {'jots':jots, 'paginator':paginator,
                                             'recent_posts':recent_posts, 'recent_comments':recent_comments,
                                             'read_most':read_most},
                                             context_instance=RequestContext(request))
Beispiel #2
0
def view_by_tag(request, tag):
    try:
        page = int(request.GET['page'])
    except:
        page = 1
    jots = Jot.all().filter('tags = ', tag).order('-when').fetch(utils.PAGE_SIZE, utils.PAGE_SIZE * (page - 1))
    return list(request, jots)
Beispiel #3
0
def index(request):  
    try:
        page = int(request.GET['page'])
    except:
        page = 1  
    jots = Jot.all().order('-when').fetch(utils.PAGE_SIZE, utils.PAGE_SIZE * (page - 1))
    return list(request, jots)
Beispiel #4
0
 def items(self,obj):
     jots = Jot.all().order('-when').fetch(10, 0)
     return jots
Beispiel #5
0
def news(request):
    recent_posts = Jot.all().order('-when').fetch(RECENT_POST_SIZE, 0)
    recent_comments = Comment.all().order('-when').fetch(RECENT_POST_SIZE, 0)
    read_most = Jot.all().order('-read_num').fetch(RECENT_POST_SIZE, 0)
    return render_to_response('news.html', {'recent_posts':recent_posts, 'recent_comments':recent_comments, 'read_most':read_most}, context_instance=RequestContext(request))
Beispiel #6
0
def about(request):
    about = Jot.all().filter('tags =', 'about').get()
    if about:
        return view(request, about.key())
    else:
        raise Http404