|
|
|
@ -74,26 +74,27 @@ def lp_media_for_type(db, type, tag=None, max_items=MAX_HOME_ITEMS_DEFAULT): |
|
|
|
|
|
|
|
|
|
@user_not_banned |
|
|
|
|
def frontpage_view(request): |
|
|
|
|
config = get_config('mediagoblin.plugins.mediagoblin-oyd') |
|
|
|
|
categories = config.items() |
|
|
|
|
|
|
|
|
|
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', None, MAX_HOME_ALL_VIDEO_ITEMS) |
|
|
|
|
|
|
|
|
|
logolar = lp_media_for_type(request.db, u'mediagoblin.media_types.image', "logo", MAX_HOME_LP_ITEMS) |
|
|
|
|
bultenler = lp_media_for_type(request.db, u'mediagoblin.media_types.pdf', "bulten", MAX_HOME_LP_ITEMS) |
|
|
|
|
yayinlar = lp_media_for_type(request.db, u'mediagoblin.media_types.pdf', "yayin", MAX_HOME_LP_ITEMS) |
|
|
|
|
names = [] |
|
|
|
|
for name, (type, tag) in categories: |
|
|
|
|
globals()[name] = lp_media_for_type(request.db, u'mediagoblin.media_types.{}'.format(type), tag, MAX_HOME_FEATURED_ITEMS) |
|
|
|
|
names.append(name) |
|
|
|
|
# logolar = lp_media_for_type(request.db, u'mediagoblin.media_types.image', "logo", MAX_HOME_LP_ITEMS) |
|
|
|
|
# bultenler = lp_media_for_type(request.db, u'mediagoblin.media_types.pdf', "bulten", MAX_HOME_LP_ITEMS) |
|
|
|
|
# yayinlar = lp_media_for_type(request.db, u'mediagoblin.media_types.pdf', "yayin", MAX_HOME_LP_ITEMS) |
|
|
|
|
|
|
|
|
|
featured_images = lp_media_for_type(request.db, u'mediagoblin.media_types.image', FEATURED_TAG, MAX_HOME_FEATURED_ITEMS) |
|
|
|
|
featured_videos = lp_media_for_type(request.db, u'mediagoblin.media_types.video', FEATURED_TAG, MAX_HOME_FEATURED_ITEMS) |
|
|
|
|
|
|
|
|
|
send_dict = {'images': images, 'videos': videos, 'featured_videos': featured_videos, 'allow_registration': mg_globals.app_config["allow_registration"]} |
|
|
|
|
for item in names: |
|
|
|
|
send_dict[item] = item |
|
|
|
|
return render_to_response( |
|
|
|
|
request, 'oyd/root.html', |
|
|
|
|
{'images': images, |
|
|
|
|
'videos': videos, |
|
|
|
|
'logolar': logolar, |
|
|
|
|
'bultenler': bultenler, |
|
|
|
|
'yayinlar': yayinlar, |
|
|
|
|
'featured_images': featured_images, |
|
|
|
|
'featured_videos': featured_videos, |
|
|
|
|
'allow_registration': mg_globals.app_config["allow_registration"]}) |
|
|
|
|
send_dict) |
|
|
|
|
|
|
|
|
|
def frontpage_view_hook(): |
|
|
|
|
return frontpage_view |
|
|
|
|