<commit_before>from django.views.generic.list import ListView
from django.views.generic.base import TemplateView
from django.views.generic.detail import DetailView
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
from django.http import Http404, HttpResponseRedirect
from django.core.urlresolvers import reverse, reverse_lazy
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from orders.models import RaceOrder, LineFollowerStage, LineFollowerRaceOrder, \
    LineFollowerJuniorStage, LineFollowerJuniorRaceOrder
from sumo.models import *


class LineFollowerStageOrderListView(ListView):
    model = LineFollowerStage
    template_name = 'orders/line_follower_stage_list.html'

    def dispatch(self, *args, **kwargs):
        if not settings.PROJECT_ORDERS or \
           not "line_follower" in dict(settings.ORDER_CATEGORIES).keys() or \
           not LineFollowerStage.objects.filter(orders_available=True).exists():
            raise PermissionDenied
        return super(LineFollowerStageOrderListView, self).dispatch(
            *args, **kwargs)

    def get_queryset(self):
        return LineFollowerStage.objects.filter(orders_available=True)


class LineFollowerRaceOrderListView(ListView):
    model = LineFollowerRaceOrder
    template_name = 'orders/race_order_list.html'

    def dispatch(self, *args, **kwargs):
        order = self.kwargs.get("order")
        if not LineFollowerStage.objects.filter(
                order=order, orders_available=True).exists():
            return PermissionDenied
        return super(LineFollowerRaceOrderListView, self).dispatch(
            *args, **kwargs)

    def get_context_data(self, **kwargs):
        context = super(LineFollowerRaceOrderListView, self).get_context_data(
            **kwargs)
        context['category'] = dict(settings.ALL_CATEGORIES)["line_follower"]
        context['stage'] = LineFollowerStage.objects.filter(
            order=self.kwargs.get("order"))[0]
        return context

    def get_queryset(self):
        return LineFollowerRaceOrder.objects.filter(
            stage__order=self.kwargs.get("order"))


class LineFollowerJuniorStageOrderListView(ListView):
    model = LineFollowerJuniorStage
    template_name = 'orders/line_follower_junior_stage_list.html'

    def dispatch(self, *args, **kwargs):
        if not settings.PROJECT_ORDERS or \
           not "line_follower_junior" in dict(settings.ORDER_CATEGORIES).keys() or \
           not LineFollowerJuniorStage.objects.filter(orders_available=True).exists():
            raise PermissionDenied
        return super(LineFollowerJuniorStageOrderListView, self).dispatch(
            *args, **kwargs)

    def get_queryset(self):
        return LineFollowerJuniorStage.objects.filter(orders_available=True)


class LineFollowerJuniorRaceOrderListView(ListView):
    model = LineFollowerJuniorRaceOrder
    template_name = 'orders/junior_race_order_list.html'

    def dispatch(self, *args, **kwargs):<commit_msg>Commented out the Line Follower Category<commit_after>from django.views.generic.list import ListView
from django.views.generic.base import TemplateView
from django.views.generic.detail import DetailView
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
from django.http import Http404, HttpResponseRedirect
from django.core.urlresolvers import reverse, reverse_lazy
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from orders.models import RaceOrder, \
    LineFollowerJuniorStage, LineFollowerJuniorRaceOrder
    # LineFollowerStage, LineFollowerRaceOrder,
from sumo.models import *


# class LineFollowerStageOrderListView(ListView):
#     model = LineFollowerStage
#     template_name = 'orders/line_follower_stage_list.html'
#
#     def dispatch(self, *args, **kwargs):
#         if not settings.PROJECT_ORDERS or \
#            not "line_follower" in dict(settings.ORDER_CATEGORIES).keys() or \
#            not LineFollowerStage.objects.filter(orders_available=True).exists():
#             raise PermissionDenied
#         return super(LineFollowerStageOrderListView, self).dispatch(
#             *args, **kwargs)
#
#     def get_queryset(self):
#         return LineFollowerStage.objects.filter(orders_available=True)


# class LineFollowerRaceOrderListView(ListView):
#     model = LineFollowerRaceOrder
#     template_name = 'orders/race_order_list.html'
#
#     def dispatch(self, *args, **kwargs):
#         order = self.kwargs.get("order")
#         if not LineFollowerStage.objects.filter(
#                 order=order, orders_available=True).exists():
#             return PermissionDenied
#         return super(LineFollowerRaceOrderListView, self).dispatch(
#             *args, **kwargs)
#
#     def get_context_data(self, **kwargs):
#         context = super(LineFollowerRaceOrderListView, self).get_context_data(
#             **kwargs)
#         context['category'] = dict(settings.ALL_CATEGORIES)["line_follower"]
#         context['stage'] = LineFollowerStage.objects.filter(
#             order=self.kwargs.get("order"))[0]
#         return context
#
#     def get_queryset(self):
#         return LineFollowerRaceOrder.objects.filter(
#             stage__order=self.kwargs.get("order"))


class LineFollowerJuniorStageOrderListView(ListView):
    model = LineFollowerJuniorStage
    template_name = 'orders/line_follower_junior_stage_list.html'

    def dispatch(self, *args, **kwargs):
        if not settings.PROJECT_ORDERS or \
           not "line_follower_junior" in dict(settings.ORDER_CATEGORIES).keys() or \
           not LineFollowerJuniorStage.objects.filter(orders_available=True).exists():
            raise PermissionDenied
        return super(LineFollowerJuniorStageOrderListView, self).dispatch(
            *args, **kwargs)

    def get_queryset(self):
        return LineFollowerJuniorStage.objects.filter(orders_available=True)


class LineFollowerJuniorRaceOrderListView(ListView):
    model = LineFollowerJuniorRaceOrder
    template_name = 'orders/junior_race_order_list.html'

    def dispatch(self, *args, **kwargs):
{'fraction_non_alphanumeric': 0.08984867591424968, 'fraction_numerical': 0.0012610340479192938, 'mean_word_length': 3.9147947327652983, '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': '7447805', 'n_tokens_mistral': 1914, 'n_tokens_neox': 1772, 'n_words': 346}