<commit_before>from django.forms import ModelForm, SelectDateWidget, CharField, Textarea

from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Fieldset, ButtonHolder, Submit, HTML
from crispy_forms.bootstrap import PrependedText

from .models import *

class ClaimedForm(ModelForm):
    class Meta:
        model = Claimed
        fields = [
            'forenames',
            'surname',
            'email',
            'phone',
            'gender',
            'home_country',
            'home_city',
            'photo',
            'research_area',
            'research_area_code',
            'affiliation',
            'funding',
            'funding_notes',
            'work_description',
            'website',
            'website_feed',
            'orcid',
            'github',
            'gitlab',
            'twitter',
            'facebook',
            ]


    required_css_class = 'form-field-required'

    def __init__(self, *args, **kwargs):
        super(ClaimedForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper(self)
        self.helper.layout = Layout(
            Fieldset(
                '',
                HTML('<h2>Personal details</h2>'),
                'forenames',
                'surname',
                'email',
                'phone',
                'gender',
                'home_country',
                'home_city',
                'photo',
                HTML('<h2>Professional details</h2>'),
                'research_area',
                'research_area_code',
                'affiliation',
                'funding',
                'funding_notes',
                'work_description',
                HTML('<h2>Social Networks</h2>'),
                'website',
                'website_feed',
                'orcid',
                'github',
                'gitlab',
                'twitter',
                'facebook',
                ButtonHolder(
                    Submit('submit', 'Add')
                )
            )
            )


class FundForm(ModelForm):
    class Meta:
        model = Fund
        exclude = [
                "status",
                "ad_status",
                "budget_approved",
                "required_blog_posts",
                "notes_from_admin",
                "added",
                "updated",
                ]

        labels = {
            'claimed': 'Requestor name',
            'category_other': 'Specify the category if used "Other"',
            'name': 'Event name',
            'url': 'Event webpage link',
            'country': 'Country in which event is taking place',
            'city': 'City in which the event is taking place',
            'start_date': 'Start date of event',
            'end_date': 'End date of event',
            'can_be_advertise_before': "Can we promote your involvement in this event before it takes place?",
            'can_be_advertise_after': "Can we promote your involvement in this event after it takes place?"
        }

        widgets = {
            'start_date': SelectDateWidget(empty_label=("Choose Year", "Choose Month", "Choose Day")),
            'end_date': SelectDateWidget(empty_label=("Choose Year", "Choose Month", "Choose Day")),
        }


    required_css_class = 'form-field-required'
    total_budget = CharField(required=False)

    def __init__(self, *args, **kwargs):
        super(FundForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper(self)
        self.helper.layout = Layout(
            Fieldset(
                '',
                HTML('<p>To apply for expenses for eligible events, please fill in this form at least one month before the start date of the event you wish to attend or organise.</p><h2>Requestor details</h2>'),
                'claimed',
                HTML('<h2>Funding request details</h2>'),
                'category',
                'category_other',
                'name',
                'url',
                'country',
                'city',
                'start_date',
                'end_date',
                HTML('<h2>Costs</h2><p>Please provide an estimate of your costs below. All values should be entered in GBP. Note that the cost entered here must be within 20% of the expenses you submit. See the terms and conditions for details (http://www.software.ac.uk/claimedship-terms-and-conditions-2016)</p><p>Please fill in all cost sections that are relevant to your event type.</p><p>The Total costs line reflect the sum of all the costs and is thus the total estimate of costs for this event.</p>'),
                PrependedText('budget_request_travel', '£', onkeyup="update_budget()"),
                PrependedText('budget_request_attendance_fees', '£', onkeyup="update_budget()"),
                PrependedText('budget_request_subsistence_cost', '£', onkeyup="update_budget()"),
                PrependedText('budget_request_venue_hire', '£', onkeyup="update_budget()"),
                PrependedText('budget_request_catering', '£', onkeyup="update_budget()"),
                PrependedText('budget_request_others', '£', onkeyup="update_budget()"),<commit_msg>Remove word about "total cost"<commit_after>from django.forms import ModelForm, SelectDateWidget, CharField, Textarea

from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Fieldset, ButtonHolder, Submit, HTML
from crispy_forms.bootstrap import PrependedText

from .models import *

class ClaimedForm(ModelForm):
    class Meta:
        model = Claimed
        fields = [
            'forenames',
            'surname',
            'email',
            'phone',
            'gender',
            'home_country',
            'home_city',
            'photo',
            'research_area',
            'research_area_code',
            'affiliation',
            'funding',
            'funding_notes',
            'work_description',
            'website',
            'website_feed',
            'orcid',
            'github',
            'gitlab',
            'twitter',
            'facebook',
            ]


    required_css_class = 'form-field-required'

    def __init__(self, *args, **kwargs):
        super(ClaimedForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper(self)
        self.helper.layout = Layout(
            Fieldset(
                '',
                HTML('<h2>Personal details</h2>'),
                'forenames',
                'surname',
                'email',
                'phone',
                'gender',
                'home_country',
                'home_city',
                'photo',
                HTML('<h2>Professional details</h2>'),
                'research_area',
                'research_area_code',
                'affiliation',
                'funding',
                'funding_notes',
                'work_description',
                HTML('<h2>Social Networks</h2>'),
                'website',
                'website_feed',
                'orcid',
                'github',
                'gitlab',
                'twitter',
                'facebook',
                ButtonHolder(
                    Submit('submit', 'Add')
                )
            )
            )


class FundForm(ModelForm):
    class Meta:
        model = Fund
        exclude = [
                "status",
                "ad_status",
                "budget_approved",
                "required_blog_posts",
                "notes_from_admin",
                "added",
                "updated",
                ]

        labels = {
            'claimed': 'Requestor name',
            'category_other': 'Specify the category if used "Other"',
            'name': 'Event name',
            'url': 'Event webpage link',
            'country': 'Country in which event is taking place',
            'city': 'City in which the event is taking place',
            'start_date': 'Start date of event',
            'end_date': 'End date of event',
            'can_be_advertise_before': "Can we promote your involvement in this event before it takes place?",
            'can_be_advertise_after': "Can we promote your involvement in this event after it takes place?"
        }

        widgets = {
            'start_date': SelectDateWidget(empty_label=("Choose Year", "Choose Month", "Choose Day")),
            'end_date': SelectDateWidget(empty_label=("Choose Year", "Choose Month", "Choose Day")),
        }


    required_css_class = 'form-field-required'
    total_budget = CharField(required=False)

    def __init__(self, *args, **kwargs):
        super(FundForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper(self)
        self.helper.layout = Layout(
            Fieldset(
                '',
                HTML('<p>To apply for expenses for eligible events, please fill in this form at least one month before the start date of the event you wish to attend or organise.</p><h2>Requestor details</h2>'),
                'claimed',
                HTML('<h2>Funding request details</h2>'),
                'category',
                'category_other',
                'name',
                'url',
                'country',
                'city',
                'start_date',
                'end_date',
                HTML('<h2>Costs</h2><p>Please provide an estimate of your costs below. All values should be entered in GBP. Note that the cost entered here must be within 20% of the expenses you submit. See the terms and conditions for details (http://www.software.ac.uk/claimedship-terms-and-conditions-2016)</p><p>Please fill in all cost sections that are relevant to your event type.</p>'),
                PrependedText('budget_request_travel', '£', onkeyup="update_budget()"),
                PrependedText('budget_request_attendance_fees', '£', onkeyup="update_budget()"),
                PrependedText('budget_request_subsistence_cost', '£', onkeyup="update_budget()"),
                PrependedText('budget_request_venue_hire', '£', onkeyup="update_budget()"),
                PrependedText('budget_request_catering', '£', onkeyup="update_budget()"),
                PrependedText('budget_request_others', '£', onkeyup="update_budget()"),
{'fraction_non_alphanumeric': 0.11376719679968778, 'fraction_numerical': 0.0035125378085666893, 'mean_word_length': 1.6973684210526316, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '48086', 'n_tokens_mistral': 2820, 'n_tokens_neox': 2609, 'n_words': 672}