<commit_before>from django.forms import ModelForm, Textarea
from django import forms
from tournaments.models import Team,Tournament, Match, MatchPoint


class TeamForm( ModelForm ):
    """ 
    Team form with upload image
    """
    class Meta:
        model   = Team
        fields  = ['name', 'nationality', 'logo']

class TournamentForm( ModelForm ):
    # control the field year by using choices instead of integer field 
    year = forms.ChoiceField(choices=[(x, x) for x in range(1900, 2000)], required=False)

    class Meta:
        model   = Tournament
        fields  = [ 'name', 'year' ]

class MatchForm( ModelForm ):
    
    class Meta:
        model   = Match
        fields  = [ 'date', 'home_team_id', 'away_team_id' ]


class MatchPointForm( ModelForm ):
    class Meta:
        model   = MatchPoint
        fields  = '__all__'
<commit_msg>tournament app: choice box year start at the current year<commit_after>from django.forms import ModelForm, Textarea
from django import forms
#from bootstrap3_datetime.widgets import DateTimePicker
from tournaments.models import Team,Tournament, Match, MatchPoint

from datetime import datetime


class TeamForm( ModelForm ):
    """ 
    Team form with upload image
    """
    class Meta:
        model   = Team
        #fields  = ['name', 'nationality', 'logo']
        fields  = ['name', 'nationality' ]

class TournamentForm( ModelForm ):
    # control the field year by using choices instead of integer field 
    currentYear = datetime.now().year
    year = forms.ChoiceField(choices=[(x, x) for x in range(2000,2033)], initial=currentYear, required=False)

    class Meta:
        model   = Tournament
        fields  = [ 'name', 'year' ]

class MatchForm( ModelForm ):
    class Meta:
        model   = Match
        fields  = [ 'date', 'home_team_id', 'away_team_id' ]


class MatchPointForm( ModelForm ):
    class Meta:
        model   = MatchPoint
        fields  = '__all__'

{'fraction_non_alphanumeric': 0.0959958932238193, 'fraction_numerical': 0.008726899383983572, 'mean_word_length': 2.9136546184738954, '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': '6774689', 'n_tokens_mistral': 580, 'n_tokens_neox': 541, 'n_words': 184}