total = c.total_found except SearchError: metas = {} total = latest_beta.count() chart_data = None data = {'opinions': latest_opinions.all()[:settings.MESSAGES_COUNT], 'opinion_count': total, 'product': prod, 'products': PROD_CHOICES, 'sentiments': get_sentiment(metas.get('type', [])), 'terms': stats.frequent_terms(qs=frequent_terms), 'locales': metas.get('locale'), 'platforms': metas.get('platform'), 'sites': sites, 'version': version, 'versions': VERSION_CHOICES['beta'][prod], 'chart_data_json': json.dumps(chart_data), 'defaults': get_defaults(search_form), 'search_form': search_form, } if not request.mobile_site: template = 'dashboard/beta.html' else: template = 'dashboard/mobile/beta.html' return jingo.render(request, template, data) dashboard = negotiate(beta=beta, release=release)
rating_form=(form if type == input.OPINION_RATING.id else RatingForm()), website_form=(form if type == input.OPINION_BROKEN.id else BrokenWebsiteForm()), idea_form=(form if type == input.OPINION_IDEA.id else IdeaReleaseForm())) else: data.update(rating_form=RatingForm(), website_form=BrokenWebsiteForm(), idea_form=IdeaReleaseForm()) template = 'feedback/%srelease_index.html' % ( 'mobile/' if request.mobile_site else '') return jingo.render(request, template, data) feedback = negotiate(beta=beta_feedback, release=release_feedback) @cache_page def need_beta(request): """Encourage people to download a current beta version.""" template = 'feedback/%sneed_beta.html' % ( 'mobile/' if request.mobile_site else '') return jingo.render(request, template) @cache_page def need_release(request): """Encourage people to download a current release version."""
page = request.GET.get('page', 1) if qs: pp = settings.SEARCH_PERPAGE pager = Paginator(qs.select_related(), pp) try: args['page'] = pager.page(page) except (EmptyPage, InvalidPage): args['page'] = pager.page(pager.num_pages) args['themes'] = args['page'].object_list return jingo.render(request, 'themes/index.html', args) index = negotiate(beta=beta_index, release=release_index) @cache_page(use_get=True) def theme(request, theme_id): try: theme = Theme.objects.get(id=theme_id, channel=get_channel()) except Theme.DoesNotExist: raise http.Http404 pager = Paginator(theme.opinions.all(), settings.SEARCH_PERPAGE) try: page = pager.page(request.GET.get('page', 1)) except (EmptyPage, InvalidPage): page = pager.page(pager.num_pages)