def get_request_promotions(request):
 promotions = PagePromotion._default_manager.select_related().prefetch_related('content_object').filter(page_url=request.path).order_by('display_order')
 if ('q' in request.GET):
  keyword_promotions = KeywordPromotion._default_manager.select_related().filter(keyword=request.GET['q'])
  if keyword_promotions.exists():
   promotions = list(chain(promotions, keyword_promotions))
 return promotions

def get_request_promotions ( request ) : promotions = PagePromotion . _default_manager . select_related ( ) . prefetch_related ( 'content_object' ) . filter ( page_url = request . path ) . order_by ( 'display_order' ) if ( 'q' in request . GET ) : keyword_promotions = KeywordPromotion . _default_manager . select_related ( ) . filter ( keyword = request . GET [ 'q' ] ) if keyword_promotions . exists ( ) : promotions = list ( chain ( promotions , keyword_promotions ) ) return promotions
return promotions relevant to this request .