Exemple #1
0
def home(request):
    articles = listing(request, Article.objects.filter(type=Article.ARTICLE).order_by('-weight'))

    return render_to_response('home.html', {
        'articles': articles
    },
        context_instance=RequestContext(request))
Exemple #2
0
def display(request, slug=None):
    if slug:
        account = get_object_or_404(Account, slug=slug)
    else:
        if request.user.is_authenticated():
            account = request.user
        else:
            raise Http404()

    return render(request, 'account/display.html', {
        'account': account,
        'can_edit': account.can_edit(request.user),
        'articles': listing(
            request,
            Article.objects.filter(type=Article.ARTICLE, author=account).order_by('-rating', 'weight')
        )
    })