def check_via_poll(request): last_feed_datetime = get_datetime_from_string(request.GET.get('last_feed')) feed_source = request.GET.get('feed_source') feed_source = feed_source if feed_source is not None else 'all' username = request.GET.get('username') user = STIPUser.objects.get(username=username) feeds = Feed.get_feeds_after(last_feed_datetime=last_feed_datetime, api_user=user) if feed_source != 'all': feeds = feeds.filter(user__id=feed_source) count = len(feeds) return HttpResponse(count)
def check(request): last_feed_datetime = get_datetime_from_string(request.GET.get('last_feed')) # feed_source は 全員のフィード取得の際は ALL,それ以外は STIPUserのid数値文字列 feed_source = request.GET.get('feed_source') user = None if feed_source != 'all': user = feed_source # 引数 rs 呼び出し用api_user,user(全員の場合はNone,それ以外はid STIP UserのID数値文字列) feeds = Feed.get_feeds_after(last_feed_datetime=last_feed_datetime, api_user=request.user, user_id=user) count = len(feeds) return HttpResponse(count)
def _html_feeds(last_feed_datetime, user, csrf_token, feed_source='all'): user_id = None if feed_source != 'all': user_id = feed_source feeds = Feed.get_feeds_after(last_feed_datetime=last_feed_datetime, api_user=user, user_id=user_id) html = '' for feed in feeds: html = '{0}{1}'.format( html, render_to_string( 'feeds/partial_feed.html', { 'feed': feed, 'jira': imported_jira, 'user': user, 'csrf_token': csrf_token })) return html