1
0
mirror of https://github.com/djohnlewis/stackdump synced 2024-12-04 23:17:37 +00:00

Added in a setting to control the number of random questions to show on the search pages.

This commit is contained in:
Samuel Lai 2012-08-25 16:20:57 +10:00
parent c240356a7b
commit af28d3e403
3 changed files with 10 additions and 3 deletions

View File

@ -272,7 +272,7 @@ def index():
context = { }
context['sites'] = get_sites()
context['random_questions'] = get_random_questions()
context['random_questions'] = get_random_questions(count=settings.NUM_OF_RANDOM_QUESTIONS)
return render_template('index.html', context)
@ -341,7 +341,7 @@ def site_index(site_key):
except SQLObjectNotFound:
raise HTTPError(code=404, output='No site exists with the key %s.' % site_key)
context['random_questions'] = get_random_questions(site_key=site_key)
context['random_questions'] = get_random_questions(site_key=site_key, count=settings.NUM_OF_RANDOM_QUESTIONS)
return render_template('index.html', context)

View File

@ -28,8 +28,12 @@ APP_URL_ROOT = '/'
# link
NUM_OF_DEFAULT_COMMENTS = 3
# number of random questions to show on search query pages
NUM_OF_RANDOM_QUESTIONS = 3
# settings that are available in templates
TEMPLATE_SETTINGS = [
'APP_URL_ROOT',
'NUM_OF_DEFAULT_COMMENTS'
'NUM_OF_DEFAULT_COMMENTS',
'NUM_OF_RANDOM_QUESTIONS'
]

View File

@ -30,3 +30,6 @@ from default_settings import *
# number of comments to show before the rest are hidden behind a 'click to show'
# link
#NUM_OF_DEFAULT_COMMENTS = 3
# number of random questions to show on search query pages
#NUM_OF_RANDOM_QUESTIONS = 3