mirror of
https://github.com/djohnlewis/stackdump
synced 2025-04-07 10:13:27 +00:00
Added in a setting to control the number of random questions to show on the search pages.
This commit is contained in:
parent
c240356a7b
commit
af28d3e403
python/src/stackdump
@ -272,7 +272,7 @@ def index():
|
|||||||
context = { }
|
context = { }
|
||||||
context['sites'] = get_sites()
|
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)
|
return render_template('index.html', context)
|
||||||
|
|
||||||
@ -341,7 +341,7 @@ def site_index(site_key):
|
|||||||
except SQLObjectNotFound:
|
except SQLObjectNotFound:
|
||||||
raise HTTPError(code=404, output='No site exists with the key %s.' % site_key)
|
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)
|
return render_template('index.html', context)
|
||||||
|
|
||||||
|
@ -28,8 +28,12 @@ APP_URL_ROOT = '/'
|
|||||||
# link
|
# link
|
||||||
NUM_OF_DEFAULT_COMMENTS = 3
|
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
|
# settings that are available in templates
|
||||||
TEMPLATE_SETTINGS = [
|
TEMPLATE_SETTINGS = [
|
||||||
'APP_URL_ROOT',
|
'APP_URL_ROOT',
|
||||||
'NUM_OF_DEFAULT_COMMENTS'
|
'NUM_OF_DEFAULT_COMMENTS',
|
||||||
|
'NUM_OF_RANDOM_QUESTIONS'
|
||||||
]
|
]
|
@ -30,3 +30,6 @@ from default_settings import *
|
|||||||
# number of comments to show before the rest are hidden behind a 'click to show'
|
# number of comments to show before the rest are hidden behind a 'click to show'
|
||||||
# link
|
# link
|
||||||
#NUM_OF_DEFAULT_COMMENTS = 3
|
#NUM_OF_DEFAULT_COMMENTS = 3
|
||||||
|
|
||||||
|
# number of random questions to show on search query pages
|
||||||
|
#NUM_OF_RANDOM_QUESTIONS = 3
|
||||||
|
Loading…
x
Reference in New Issue
Block a user