Пример #1
0
def index(request):

	if 'subreddits' in request.GET:
		subreddits = request.GET['subreddits']
	else:
		subreddits = 'adviceanimals'
	
	if 'style' in request.GET:
		style = request.GET['style']
	else:
		style = 'hot'
	
	if 'after' in request.GET:
		my_after = request.GET['after']
	else:
		my_after = ''

	result = Post.get_latest_posts(subreddits,'hot')
	
	return render(request, 'srv/main_list.html', {
		'title': subreddits,
		'subreddits': result,
	})
Пример #2
0
def ajax_more(request):
	result = Post.reddify(request.POST['subreddit'], request.POST['style'], request.POST['after'], 'string')
	json = simplejson.dumps({'string':result['string'],'after':result['after']})
	return HttpResponse(json, content_type="application/json")