예제 #1
0
파일: views.py 프로젝트: odtvince/udata
def show(post):
    others = Post.objects(id__ne=post.id).published()
    older = others(published__lt=post.published)
    newer = others(published__gt=post.published)
    return theme.render('post/display.html',
                        post=post,
                        previous_post=older.first(),
                        next_post=newer.first())
예제 #2
0
def show(post):
    others = Post.objects(id__ne=post.id).published()
    older = others(published__lt=post.published)
    newer = others(published__gt=post.published)
    return theme.render('post/display.html',
                        post=post,
                        previous_post=older.first(),
                        next_post=newer.first())
예제 #3
0
def home():
    context = {
        'recent_datasets': Dataset.objects.visible(),
        'recent_reuses': Reuse.objects(featured=True).visible(),
        'last_post': Post.objects(private=False).first(),
    }
    processor = theme.current.get_processor('home')
    context = processor(context)
    return theme.render('home.html', **context)
예제 #4
0
파일: views.py 프로젝트: anukat2015/udata
def home():
    context = {
        'recent_datasets': Dataset.objects.visible(),
        'recent_reuses': Reuse.objects(featured=True).visible(),
        'last_post': Post.objects(private=False).first(),
    }
    processor = theme.current.get_processor('home')
    context = processor(context)
    return theme.render('home.html', **context)
예제 #5
0
파일: home.py 프로젝트: rossjones/udata
def home():
    # TODO:allow customization
    recent_datasets, recent_reuses, featured_datasets, featured_reuses, popular_datasets, popular_reuses = multiquery(
        SearchQuery(DatasetSearch, sort="-created", page_size=TAB_SIZE),
        SearchQuery(ReuseSearch, sort="-created", page_size=TAB_SIZE),
        SearchQuery(DatasetSearch, featured=True, page_size=3),
        SearchQuery(ReuseSearch, featured=True, page_size=3),
        SearchQuery(DatasetSearch, page_size=TAB_SIZE),
        SearchQuery(ReuseSearch, page_size=TAB_SIZE),
    )

    return render(
        "home.html",
        recent_datasets=recent_datasets,
        recent_reuses=recent_reuses,
        featured_datasets=featured_datasets,
        featured_reuses=featured_reuses,
        popular_datasets=popular_datasets,
        popular_reuses=popular_reuses,
        last_post=Post.objects(private=False).order_by("-created_at").first(),  # TODO extract into extension
    )
예제 #6
0
파일: views.py 프로젝트: anukat2015/udata
def sitemap_urls():
    for post in Post.objects(private=False).only('id', 'slug'):
        yield 'posts.show_redirect', {'post': post}, None, "weekly", 0.6
예제 #7
0
def sitemap_urls():
    for post in Post.objects(private=False).only('id', 'slug'):
        yield 'posts.show_redirect', {'post': post}, None, "weekly", 0.6
예제 #8
0
파일: views.py 프로젝트: grouan/udata
def sitemap_urls():
    for post in Post.objects(private=False):
        yield 'posts.show_redirect', {'post': post.slug}, None, "weekly", 0.5