# Path: cab/models.py
# class Language(models.Model):
#     name = models.CharField(max_length=100)
#     slug = models.SlugField(unique=True)
#     language_code = models.CharField(max_length=50)
#     mime_type = models.CharField(max_length=100)
#     file_extension = models.CharField(max_length=10)
# 
#     objects = LanguageManager()
# 
#     class Meta:
#         ordering = ("name",)
# 
#     def __str__(self):
#         return self.name
# 
#     def get_absolute_url(self):
#         return reverse("cab_language_detail", kwargs={"slug": self.slug})
# 
#     def get_lexer(self):
#         return lexers.get_lexer_by_name(self.language_code)
# 
# Path: cab/utils.py
# def month_object_list(request, queryset, *args, **kwargs):
#     extra_context = kwargs.pop("extra_context", {})
# 
#     if "months" in request.GET and request.GET["months"].isdigit():
#         months = int(request.GET["months"])
#         queryset = queryset.filter(pub_date__gt=get_past_datetime(months))
#         extra_context["months"] = months
# 
#     kwargs["extra_context"] = extra_context
# 
#     return object_list(request, queryset, *args, **kwargs)
# 
# def object_list(
#     request,
#     queryset,
#     paginate_by=None,
#     page=None,
#     allow_empty=True,
#     template_name=None,
#     template_loader=loader,
#     extra_context=None,
#     template_object_name="object",
#     content_type=None,
# ):
#     """
#     Generic list of objects.
# 
#     Templates: ``<app_label>/<model_name>_list.html``
#     Context:
#         object_list
#             list of objects
#         is_paginated
#             are the results paginated?
#         results_per_page
#             number of objects per page (if paginated)
#         has_next
#             is there a next page?
#         has_previous
#             is there a prev page?
#         page
#             the current page
#         next
#             the next page
#         previous
#             the previous page
#         pages
#             number of pages, total
#         hits
#             number of objects, total
#         last_on_page
#             the result number of the last of object in the
#             object_list (1-indexed)
#         first_on_page
#             the result number of the first object in the
#             object_list (1-indexed)
#         page_range:
#             A list of the page numbers (1-indexed).
#     """
#     if extra_context is None:
#         extra_context = {}
#     queryset = queryset._clone()
#     if paginate_by:
#         paginator = Paginator(queryset, paginate_by, allow_empty_first_page=allow_empty)
#         if not page:
#             page = request.GET.get("page", 1)
# 
#         if page == "last":
#             page_number = paginator.num_pages
#         else:
#             try:
#                 page_number = int(page)
#             except ValueError:
#                 # Page is not 'last', nor can it be converted to an int.
#                 raise Http404
#         try:
#             page_obj = paginator.page(page_number)
#         except InvalidPage:
#             raise Http404
#         try:
#             next_page = page_obj.next_page_number()
#         except InvalidPage:
#             next_page = None
#         try:
#             previous_page = page_obj.previous_page_number()
#         except InvalidPage:
#             previous_page = None
# 
#         c = {
#             "%s_list" % template_object_name: page_obj.object_list,
#             "paginator": paginator,
#             "page_obj": page_obj,
#             "is_paginated": page_obj.has_other_pages(),
#             # Legacy template context stuff. New templates should use page_obj
#             # to access this instead.
#             "results_per_page": paginator.per_page,
#             "has_next": page_obj.has_next(),
#             "has_previous": page_obj.has_previous(),
#             "page": page_obj.number,
#             "next": next_page,
#             "previous": previous_page,
#             "first_on_page": page_obj.start_index(),
#             "last_on_page": page_obj.end_index(),
#             "pages": paginator.num_pages,
#             "hits": paginator.count,
#             "page_range": paginator.page_range,
#         }
#     else:
#         c = {
#             "%s_list" % template_object_name: queryset,
#             "paginator": None,
#             "page_obj": None,
#             "is_paginated": False,
#         }
#         if not allow_empty and len(queryset) == 0:
#             raise Http404
# 
#     for key, value in extra_context.items():
#         if callable(value):
#             c[key] = value()
#         else:
#             c[key] = value
#     if not template_name:
#         model = queryset.model
#         template_name = "%s/%s_list.html" % (model._meta.app_label, model._meta.object_name.lower())
#     t = template_loader.get_template(template_name)
#     return HttpResponse(t.render(c, request=request), content_type=content_type)


from django.shortcuts import get_object_or_404
from ..models import Language
from ..utils import month_object_list, object_list



def language_list(request):
    return object_list(
        request,

# Path: cab/models.py
# class Language(models.Model):
#     name = models.CharField(max_length=100)
#     slug = models.SlugField(unique=True)
#     language_code = models.CharField(max_length=50)
#     mime_type = models.CharField(max_length=100)
#     file_extension = models.CharField(max_length=10)
# 
#     objects = LanguageManager()
# 
#     class Meta:
#         ordering = ("name",)
# 
#     def __str__(self):
#         return self.name
# 
#     def get_absolute_url(self):
#         return reverse("cab_language_detail", kwargs={"slug": self.slug})
# 
#     def get_lexer(self):
#         return lexers.get_lexer_by_name(self.language_code)
# 
# Path: cab/utils.py
# def month_object_list(request, queryset, *args, **kwargs):
#     extra_context = kwargs.pop("extra_context", {})
# 
#     if "months" in request.GET and request.GET["months"].isdigit():
#         months = int(request.GET["months"])
#         queryset = queryset.filter(pub_date__gt=get_past_datetime(months))
#         extra_context["months"] = months
# 
#     kwargs["extra_context"] = extra_context
# 
#     return object_list(request, queryset, *args, **kwargs)
# 
# def object_list(
#     request,
#     queryset,
#     paginate_by=None,
#     page=None,
#     allow_empty=True,
#     template_name=None,
#     template_loader=loader,
#     extra_context=None,
#     template_object_name="object",
#     content_type=None,
# ):
#     """
#     Generic list of objects.
# 
#     Templates: ``<app_label>/<model_name>_list.html``
#     Context:
#         object_list
#             list of objects
#         is_paginated
#             are the results paginated?
#         results_per_page
#             number of objects per page (if paginated)
#         has_next
#             is there a next page?
#         has_previous
#             is there a prev page?
#         page
#             the current page
#         next
#             the next page
#         previous
#             the previous page
#         pages
#             number of pages, total
#         hits
#             number of objects, total
#         last_on_page
#             the result number of the last of object in the
#             object_list (1-indexed)
#         first_on_page
#             the result number of the first object in the
#             object_list (1-indexed)
#         page_range:
#             A list of the page numbers (1-indexed).
#     """
#     if extra_context is None:
#         extra_context = {}
#     queryset = queryset._clone()
#     if paginate_by:
#         paginator = Paginator(queryset, paginate_by, allow_empty_first_page=allow_empty)
#         if not page:
#             page = request.GET.get("page", 1)
# 
#         if page == "last":
#             page_number = paginator.num_pages
#         else:
#             try:
#                 page_number = int(page)
#             except ValueError:
#                 # Page is not 'last', nor can it be converted to an int.
#                 raise Http404
#         try:
#             page_obj = paginator.page(page_number)
#         except InvalidPage:
#             raise Http404
#         try:
#             next_page = page_obj.next_page_number()
#         except InvalidPage:
#             next_page = None
#         try:
#             previous_page = page_obj.previous_page_number()
#         except InvalidPage:
#             previous_page = None
# 
#         c = {
#             "%s_list" % template_object_name: page_obj.object_list,
#             "paginator": paginator,
#             "page_obj": page_obj,
#             "is_paginated": page_obj.has_other_pages(),
#             # Legacy template context stuff. New templates should use page_obj
#             # to access this instead.
#             "results_per_page": paginator.per_page,
#             "has_next": page_obj.has_next(),
#             "has_previous": page_obj.has_previous(),
#             "page": page_obj.number,
#             "next": next_page,
#             "previous": previous_page,
#             "first_on_page": page_obj.start_index(),
#             "last_on_page": page_obj.end_index(),
#             "pages": paginator.num_pages,
#             "hits": paginator.count,
#             "page_range": paginator.page_range,
#         }
#     else:
#         c = {
#             "%s_list" % template_object_name: queryset,
#             "paginator": None,
#             "page_obj": None,
#             "is_paginated": False,
#         }
#         if not allow_empty and len(queryset) == 0:
#             raise Http404
# 
#     for key, value in extra_context.items():
#         if callable(value):
#             c[key] = value()
#         else:
#             c[key] = value
#     if not template_name:
#         model = queryset.model
#         template_name = "%s/%s_list.html" % (model._meta.app_label, model._meta.object_name.lower())
#     t = template_loader.get_template(template_name)
#     return HttpResponse(t.render(c, request=request), content_type=content_type)


# Path: cab/views/languages.py
from django.shortcuts import get_object_or_404
from ..models import Language
from ..utils import month_object_list, object_list




def language_list(request):
    return object_list(
        request,

        queryset=Language.objects.all(),