def sitemap_xml(request): """ Display list of new snippets upto 1000 """ snippets = Snippet.get_snippets(request.user, 0, 1000, True) for snippet in snippets: snippet.priority = round(snippet.rating(), 1) return render_to_response('app/sitemap.xml', locals(), mimetype='application/xml')
def index(request, page_index=0, sort_by_new=False): """ Display all snippets """ page_index = int(page_index) active = 'new' if sort_by_new else 'top' snippets = Snippet.get_snippets(request.user, page_index, settings.PAGE_SIZE, sort_by_new) prev_url, next_url = paginated_url(request.resolver_match.url_name, snippets, [page_index]) recent_sign_ups = User.get_recent_users() return render_response(request, 'app/home_snippets.html', locals())