<commit_before># -*- coding: utf-8 -*-
from django import forms
from django.core.exceptions import NON_FIELD_ERRORS
from django.utils.translation import ugettext_lazy as _

from core import models

DUPLICATE_PLAYER_ERROR = \
    _('There is already a player with this name in your game')
class CreateGameForm(forms.Form):
    bank_cash = forms.IntegerField(required=False, initial=12000)

    def clean_bank_cash(self):
        data = self.cleaned_data['bank_cash']
        if data == None:
            data = 0
        return data


class AddPlayerForm(forms.ModelForm):
    class Meta:
        model = models.Player
        fields = ('game', 'name', 'cash')

        error_messages = {
            NON_FIELD_ERRORS: {'unique_together': DUPLICATE_PLAYER_ERROR},
        }
<commit_msg>Hide Game ID input since it is automatically set<commit_after># -*- coding: utf-8 -*-
from django import forms
from django.core.exceptions import NON_FIELD_ERRORS
from django.utils.translation import ugettext_lazy as _

from core import models

DUPLICATE_PLAYER_ERROR = \
    _('There is already a player with this name in your game')
class CreateGameForm(forms.Form):
    bank_cash = forms.IntegerField(required=False, initial=12000)

    def clean_bank_cash(self):
        data = self.cleaned_data['bank_cash']
        if data == None:
            data = 0
        return data


class AddPlayerForm(forms.ModelForm):
    class Meta:
        model = models.Player
        fields = ('game', 'name', 'cash')

        error_messages = {
            NON_FIELD_ERRORS: {'unique_together': DUPLICATE_PLAYER_ERROR},
        }
        widgets = {
            'game': forms.HiddenInput(),
        }

{'fraction_non_alphanumeric': 0.09427207637231504, 'fraction_numerical': 0.008353221957040573, 'mean_word_length': 2.9, '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': '4900001', 'n_tokens_mistral': 518, 'n_tokens_neox': 488, 'n_words': 135}