addons-server/mkt/home/views.py

22 строки
587 B
Python
Исходник Обычный вид История

2012-04-06 02:48:54 +04:00
import jingo
import mkt
2012-04-08 04:27:18 +04:00
from mkt.webapps.models import Webapp
2012-04-06 02:48:54 +04:00
2012-04-11 12:29:56 +04:00
# TODO: Cache this soooo hard.
2012-04-06 02:48:54 +04:00
def home(request):
"""The home page."""
if not getattr(request, 'can_view_consumer', True):
return jingo.render(request, 'home/home_walled.html')
featured = Webapp.featured(
cat=None,
region=getattr(request, 'REGION', mkt.regions.WORLDWIDE))
popular = Webapp.popular()[:10]
latest = Webapp.latest()[:10]
return jingo.render(request, 'home/home.html', {
'featured': featured,
'popular': popular,
'latest': latest
})