@cronjobs.register
def escalate_questions():
 if settings.STAGE:
  return
 qs = Question.objects.needs_attention().exclude(tags__slug__in=[config.ESCALATE_TAG_NAME])
 qs = qs.filter(locale=settings.WIKI_DEFAULT_LANGUAGE)
 qs = qs.exclude(product__slug__in=config.ESCALATE_EXCLUDE_PRODUCTS)
 qs = qs.exclude(creator__is_active=False)
 start = (datetime.now() - timedelta(hours=24))
 end = (datetime.now() - timedelta(hours=25))
 qs_no_replies_yet = qs.filter(last_answer__isnull=True, created__lt=start, created__gt=end)
 for question in qs_no_replies_yet:
  escalate_question.delay(question.id)
 return len(qs_no_replies_yet)

@ cronjobs . register def escalate_questions ( ) : if settings . STAGE : return qs = Question . objects . needs_attention ( ) . exclude ( tags__slug__in = [ config . ESCALATE_TAG_NAME ] ) qs = qs . filter ( locale = settings . WIKI_DEFAULT_LANGUAGE ) qs = qs . exclude ( product__slug__in = config . ESCALATE_EXCLUDE_PRODUCTS ) qs = qs . exclude ( creator__is_active = False ) start = ( datetime . now ( ) - timedelta ( hours = 24 ) ) end = ( datetime . now ( ) - timedelta ( hours = 25 ) ) qs_no_replies_yet = qs . filter ( last_answer__isnull = True , created__lt = start , created__gt = end ) for question in qs_no_replies_yet : escalate_question . delay ( question . id ) return len ( qs_no_replies_yet )
escalate questions needing attention .