<commit_before>from django import forms
from order.models import Ticket, HardwareSoftware, Service, Event
from django.forms import RadioSelect, Select, TextInput
from django.utils.translation import ugettext_lazy as _


TRIP_ANSWER = (
    ('False', _('Round Trip')),
    ('True', _('One Way')),
)

TRANSPORTATION = (
    ('False', _('Aerial ')),
    ('True', _('Terrestrial')),
)

TIME = (
    ('0', _('-------------------')),
    ('1', _('Morning (6am - 12pm)')),
    ('2', _('Afternoon (12pm - 6pm)')),
    ('3', _('Evening (6pm - 12am)')),
    ('4', _('Night (12am - 6am)')),
)

ORIGIN = (
    ('0', _('National')),
    ('1', _('Imported'))
)

CATEGORY = (
    ('0', _('Permanent material')),
    ('1', _('Consumption items'))
)


class TicketAdminForm(forms.ModelForm):

    class Meta:
        model = Ticket

        fields = ['type', 'outbound_date_preference', 'inbound_date_preference', 'type_transportation']

        widgets = {
            'type': RadioSelect(choices=TRIP_ANSWER),
            'type_transportation': RadioSelect(choices=TRANSPORTATION),
            'outbound_date_preference': Select(choices=TIME),
            'inbound_date_preference': Select(choices=TIME),
        }

    class Media:
        js = ('/static/js/order.js',)
        css = {
            'all': ('/static/css/customization.css',)
        }


class HardwareSoftwareAdminForm(forms.ModelForm):

    class Meta:
        model = HardwareSoftware

        fields = ['origin', 'category', 'url', 'institution']

        widgets = {
            'origin': RadioSelect(choices=ORIGIN),
            'category': RadioSelect(choices=CATEGORY),
            'url': TextInput(attrs={'size': 80, 'placeholder': 'http://myproduct.example.com/product01'}),
            'institution': Select(attrs={'onchange': 'ajax_filter_departments(this.value);'}),
        }

    class Media:
        js = ('/static/js/order.js',)
        css = {
            'all': ('/static/css/customization.css',)
        }


class ServiceAdminForm(forms.ModelForm):

    class Meta:
        model = Service

        fields = ['origin']

        widgets = {
            'origin': RadioSelect(choices=ORIGIN),
        }

    class Media:
        css = {
            'all': ('/static/css/customization.css',)
        }


class EventAdminForm(forms.ModelForm):

    class Meta:
        model = Event<commit_msg>Javascript code separation<commit_after>from django import forms
from order.models import Ticket, HardwareSoftware, Service, Event
from django.forms import RadioSelect, Select, TextInput
from django.utils.translation import ugettext_lazy as _


TRIP_ANSWER = (
    ('False', _('Round Trip')),
    ('True', _('One Way')),
)

TRANSPORTATION = (
    ('False', _('Aerial ')),
    ('True', _('Terrestrial')),
)

TIME = (
    ('0', _('-------------------')),
    ('1', _('Morning (6am - 12pm)')),
    ('2', _('Afternoon (12pm - 6pm)')),
    ('3', _('Evening (6pm - 12am)')),
    ('4', _('Night (12am - 6am)')),
)

ORIGIN = (
    ('0', _('National')),
    ('1', _('Imported'))
)

CATEGORY = (
    ('0', _('Permanent material')),
    ('1', _('Consumption items'))
)


class TicketAdminForm(forms.ModelForm):

    class Meta:
        model = Ticket

        fields = ['type', 'outbound_date_preference', 'inbound_date_preference', 'type_transportation']

        widgets = {
            'type': RadioSelect(choices=TRIP_ANSWER),
            'type_transportation': RadioSelect(choices=TRANSPORTATION),
            'outbound_date_preference': Select(choices=TIME),
            'inbound_date_preference': Select(choices=TIME),
        }

    class Media:
        js = ('/static/js/order_ticket.js',)
        css = {
            'all': ('/static/css/customization.css',)
        }


class HardwareSoftwareAdminForm(forms.ModelForm):

    class Meta:
        model = HardwareSoftware

        fields = ['origin', 'category', 'url', 'institution']

        widgets = {
            'origin': RadioSelect(choices=ORIGIN),
            'category': RadioSelect(choices=CATEGORY),
            'url': TextInput(attrs={'size': 80, 'placeholder': 'http://myproduct.example.com/product01'}),
            'institution': Select(attrs={'onchange': 'ajax_filter_departments(this.value);'}),
        }

    class Media:
        js = ('/static/js/order_hardware_software.js',)
        css = {
            'all': ('/static/css/customization.css',)
        }


class ServiceAdminForm(forms.ModelForm):

    class Meta:
        model = Service

        fields = ['origin']

        widgets = {
            'origin': RadioSelect(choices=ORIGIN),
        }

    class Media:
        css = {
            'all': ('/static/css/customization.css',)
        }


class EventAdminForm(forms.ModelForm):

    class Meta:
        model = Event
{'fraction_non_alphanumeric': 0.17276166456494324, 'fraction_numerical': 0.010508617065994116, 'mean_word_length': 2.5541448842419716, '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': '453925', 'n_tokens_mistral': 1584, 'n_tokens_neox': 1500, 'n_words': 289}