<commit_before>from django.utils import timezone
from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.core.urlresolvers import reverse
from django.db.models import F

from .models import Question, Choice

from polls.tasks import add, long_task, debug_task


def index(request):
    # test Celery
    debug_task.delay()
    add.delay(1, 2)
    # this task sleep for 20 seconds, but it run in another thread by Celery
    long_task.delay(20)


    latest_question_list = Question.objects.filter(
        pub_date__lte=timezone.now()
    ).order_by('-pub_date')[:5]
    context = dict(latest_question_list=latest_question_list)
    return render(request, 'polls/index.html', context=context)

def detail(request, question_id):
    question = get_object_or_404(
        Question,
        pk=question_id,<commit_msg>removed calling tasks in view (example)<commit_after>from django.utils import timezone
from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.core.urlresolvers import reverse
from django.db.models import F

from .models import Question, Choice

from polls.tasks import add, long_task, debug_task


def index(request):
    latest_question_list = Question.objects.filter(
        pub_date__lte=timezone.now()
    ).order_by('-pub_date')[:5]
    context = dict(latest_question_list=latest_question_list)
    return render(request, 'polls/index.html', context=context)

def detail(request, question_id):
    question = get_object_or_404(
        Question,
        pk=question_id,
{'fraction_non_alphanumeric': 0.08313106796116505, 'fraction_numerical': 0.015776699029126214, 'mean_word_length': 4.6279863481228665, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6300772', 'n_tokens_mistral': 513, 'n_tokens_neox': 488, 'n_words': 130}