<commit_before>from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.http import Http404, HttpResponse
from django.shortcuts import get_object_or_404, redirect
from django.template.loader import render_to_string
from django.template.response import TemplateResponse
from django.views.decorators.http import require_http_methods
from django.utils import timezone

from us_ignite.apps.forms import (ApplicationForm, ApplicationLinkFormSet,
                                  MembershipForm, ApplicationMediaFormSet,
                                  ApplicationMembershipFormSet)
from us_ignite.apps.models import (Application, ApplicationMembership,
                                   ApplicationVersion, Domain, Page)
from us_ignite.awards.models import ApplicationAward
from us_ignite.common import pagination, forms
from us_ignite.hubs.forms import HubAppMembershipForm
from us_ignite.hubs.models import HubAppMembership


APPS_SORTING_CHOICES = (
    ('', 'Select ordering'),
    ('created', 'Created (Oldest first)'),
    ('-created', 'Created (Recent first)'),
)


def app_list(request, domain=None):
    """Lists the published ``Applications``"""
    if domain:
        domain = get_object_or_404(Domain, slug=domain)
    extra_qs = {'domain': domain} if domain else {}
    page_no = pagination.get_page_no(request.GET)
    # Validate the domain is valid if provided:
    order_form = forms.OrderForm(
        request.GET, order_choices=APPS_SORTING_CHOICES)<commit_msg>Add ordering by stage of the app.<commit_after>from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.http import Http404, HttpResponse
from django.shortcuts import get_object_or_404, redirect
from django.template.loader import render_to_string
from django.template.response import TemplateResponse
from django.views.decorators.http import require_http_methods
from django.utils import timezone

from us_ignite.apps.forms import (ApplicationForm, ApplicationLinkFormSet,
                                  MembershipForm, ApplicationMediaFormSet,
                                  ApplicationMembershipFormSet)
from us_ignite.apps.models import (Application, ApplicationMembership,
                                   ApplicationVersion, Domain, Page)
from us_ignite.awards.models import ApplicationAward
from us_ignite.common import pagination, forms
from us_ignite.hubs.forms import HubAppMembershipForm
from us_ignite.hubs.models import HubAppMembership


APPS_SORTING_CHOICES = (
    ('', 'Select ordering'),
    ('created', 'Created (Oldest first)'),
    ('-created', 'Created (Recent first)'),
    ('stage', 'Stage (Ideas first)'),
    ('-stage', 'Stage (Completed first)'),
)


def app_list(request, domain=None):
    """Lists the published ``Applications``"""
    if domain:
        domain = get_object_or_404(Domain, slug=domain)
    extra_qs = {'domain': domain} if domain else {}
    page_no = pagination.get_page_no(request.GET)
    # Validate the domain is valid if provided:
    order_form = forms.OrderForm(
        request.GET, order_choices=APPS_SORTING_CHOICES)
{'fraction_non_alphanumeric': 0.08177496038034865, 'fraction_numerical': 0.005705229793977813, 'mean_word_length': 3.923556942277691, '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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3914811', 'n_tokens_mistral': 882, 'n_tokens_neox': 841, 'n_words': 231}