changed number of items on front page

... including the "all videos/photos" sections. also changed the default
amount to 10.
remotes/1726741609412457634/master
Andrew Engelbrecht 8 years ago
parent b05a246734
commit 7c3fc209a1
  1. 11
      mediagoblin_libreplanet/__init__.py

@ -35,7 +35,10 @@ SUPPORTED_LICENSES[cc_by_sa_4.uri] = cc_by_sa_4
PLUGIN_DIR = os.path.dirname(__file__) PLUGIN_DIR = os.path.dirname(__file__)
MAX_HOME_ITEMS = 20 MAX_HOME_ITEMS_DEFAULT = 10
MAX_HOME_ALL_VIDEO_ITEMS = 10
MAX_HOME_ALL_PHOTO_ITEMS = 20
MAX_HOME_FEATURED_ITEMS = 10 MAX_HOME_FEATURED_ITEMS = 10
MAX_HOME_LP_ITEMS = 10 MAX_HOME_LP_ITEMS = 10
@ -55,7 +58,7 @@ def setup_plugin():
# Register the template path. # Register the template path.
register_template_path(os.path.join(PLUGIN_DIR, 'templates')) register_template_path(os.path.join(PLUGIN_DIR, 'templates'))
def lp_media_for_type(db, type, tag=None, max_items=MAX_HOME_ITEMS): def lp_media_for_type(db, type, tag=None, max_items=MAX_HOME_ITEMS_DEFAULT):
if (tag == None): if (tag == None):
cursor = MediaEntry.query cursor = MediaEntry.query
else: else:
@ -69,8 +72,8 @@ def lp_media_for_type(db, type, tag=None, max_items=MAX_HOME_ITEMS):
@user_not_banned @user_not_banned
def frontpage_view(request): def frontpage_view(request):
images = lp_media_for_type(request.db, u'mediagoblin.media_types.image') images = lp_media_for_type(request.db, u'mediagoblin.media_types.image', None, MAX_HOME_ALL_PHOTO_ITEMS)
videos = lp_media_for_type(request.db, u'mediagoblin.media_types.video') videos = lp_media_for_type(request.db, u'mediagoblin.media_types.video', None, MAX_HOME_ALL_VIDEO_ITEMS)
lp2016_videos = lp_media_for_type(request.db, u'mediagoblin.media_types.video', LATEST_LP_VIDEO_TAG, MAX_HOME_LP_ITEMS) lp2016_videos = lp_media_for_type(request.db, u'mediagoblin.media_types.video', LATEST_LP_VIDEO_TAG, MAX_HOME_LP_ITEMS)

Loading…
Cancel
Save