python - Django random sort list -
how can sort rundom list 'articles_list' when db?
def article_theme(request, articleblock_id=2): return render_to_response('article_theme.html', {"articleblock_name": articleblock.objects.get(id=articleblock_id), 'articles_list': articles.objects.filter (articles_articleblock_id=articleblock_id)})
here is:
articles.objects.filter(articles_articleblock_id=articleblock_id).order_by('?')
Comments
Post a Comment