<commit_before># -*- coding: utf-8 -*-
from django.conf import settings
from django.db.models import Count
from django.template import RequestContext
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, Http404
from django.contrib.auth.decorators import login_required
from django.shortcuts import render_to_response, get_object_or_404

from djspace.application.forms import *
from djspace.application.models import RocketLaunchTeam, ROCKET_COMPETITIONS
from djspace.registration.models import *
from djspace.core.utils import get_profile_status

from djtools.utils.mail import send_mail

import logging
logger = logging.getLogger(__name__)
#logger.debug("limit = {}".format(data.limit))


@login_required
def application_form(request, application_type, aid=None):

    # our user
    user = request.user

    # verify that the user has completed registration
    reg_type = user.profile.registration_type
    try:
        reg = eval(reg_type).objects.get(user=user)
    except:
        # redirect to dashboard
        return HttpResponseRedirect(reverse('dashboard_home'))

    # verify that the user has an up to date registration
    if not get_profile_status(user):
        # redirect to dashboard
        return HttpResponseRedirect(reverse('dashboard_home'))

    # munge the application type
    slug_list = application_type.split("-")
    app_name = slug_list.pop(0).capitalize()
    for n in slug_list:
        app_name += " %s" % n.capitalize()
    app_type = "".join(app_name.split(" "))

    # check rocket competition teams and member limits.
    # currently, only midwest high-powered has a limit
    # so we can exclude on the original statement
    if "rocket-competition" in application_type:
        teams = RocketLaunchTeam.objects.filter(
            tags__name__in=[app_name]
        )

        if application_type != "first-nations-rocket-competition":
            teams.annotate(
                count=Count('members')
            ).exclude(
                count__gte=settings.ROCKET_LAUNCH_COMPETITION_TEAM_LIMIT
            ).order_by("name")

        if not teams:
            return render_to_response(
                "application/form.html",<commit_msg>updated comments to reflect the nature of the rocket launch member limits<commit_after># -*- coding: utf-8 -*-
from django.conf import settings
from django.db.models import Count
from django.template import RequestContext
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, Http404
from django.contrib.auth.decorators import login_required
from django.shortcuts import render_to_response, get_object_or_404

from djspace.application.forms import *
from djspace.application.models import RocketLaunchTeam, ROCKET_COMPETITIONS
from djspace.registration.models import *
from djspace.core.utils import get_profile_status

from djtools.utils.mail import send_mail

import logging
logger = logging.getLogger(__name__)
#logger.debug("limit = {}".format(data.limit))


@login_required
def application_form(request, application_type, aid=None):

    # our user
    user = request.user

    # verify that the user has completed registration
    reg_type = user.profile.registration_type
    try:
        reg = eval(reg_type).objects.get(user=user)
    except:
        # redirect to dashboard
        return HttpResponseRedirect(reverse('dashboard_home'))

    # verify that the user has an up to date registration
    if not get_profile_status(user):
        # redirect to dashboard
        return HttpResponseRedirect(reverse('dashboard_home'))

    # munge the application type
    slug_list = application_type.split("-")
    app_name = slug_list.pop(0).capitalize()
    for n in slug_list:
        app_name += " %s" % n.capitalize()
    app_type = "".join(app_name.split(" "))

    # check rocket competition teams and member limits.
    # currently, FNL does not have a limit so we can exclude it.
    if "rocket-competition" in application_type:
        teams = RocketLaunchTeam.objects.filter(
            tags__name__in=[app_name]
        )

        if application_type != "first-nations-rocket-competition":
            teams.annotate(
                count=Count('members')
            ).exclude(
                count__gte=settings.ROCKET_LAUNCH_COMPETITION_TEAM_LIMIT
            ).order_by("name")

        if not teams:
            return render_to_response(
                "application/form.html",
{'fraction_non_alphanumeric': 0.08225011205737337, 'fraction_numerical': 0.003585835948005379, 'mean_word_length': 3.324612403100775, 'pattern_counts': {'":': 2, '<': 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': '2617456', 'n_tokens_mistral': 1272, 'n_tokens_neox': 1230, 'n_words': 333}