<commit_before>from django.forms import ModelForm, HiddenInput, IntegerField
from django.forms.formsets import formset_factory
#from django.forms.extras.widgets import HiddenInput

from nodemanager.models import ConceptAtom

class AtomForm(ModelForm):

    pk = IntegerField(widget=HiddenInput(attrs={'readonly': True}),
                      required=False)

    class Meta:
        model = ConceptAtom
        fields = ['text']

    def clean_text(self):
        data = self.cleaned_data['text']
        if not data:
            raise forms.ValidationError("Can't have an empty Concept Atom!")

        return data

    # def clean_pk(self):
    #     data = self.cleaned_data['pk']

    #     if not data:
    #         data = -1

AtomFormSet = formset_factory(AtomForm,
                              can_delete=True,
                              extra=5,)<commit_msg>cleaned up forms a bit more<commit_after>from django.forms import ModelForm, HiddenInput, IntegerField
from django.forms.formsets import formset_factory
#from django.forms.extras.widgets import HiddenInput

from nodemanager.models import ConceptAtom

class AtomForm(ModelForm):

    pk = IntegerField(widget=HiddenInput(attrs={'readonly': True}),
                      required=False)

    class Meta:
        model = ConceptAtom
        fields = ['text']

    def clean_text(self):
        data = self.cleaned_data['text']
        if not data:
            raise forms.ValidationError("Can't have an empty Concept Atom!")

        return data

AtomFormSet = formset_factory(AtomForm,
                              can_delete=True,
                              extra=5,)
{'fraction_non_alphanumeric': 0.08526187576126674, 'fraction_numerical': 0.0018270401948842874, 'mean_word_length': 2.359918200408998, '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': '4714125', 'n_tokens_mistral': 470, 'n_tokens_neox': 439, 'n_words': 113}