<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django import forms

from .models import Image
from .widgets import MultipleUpload, CropExample


class ImageModelForm(forms.ModelForm):
    image = forms.FileField(required=True, widget=MultipleUpload())
    crop_example = forms.CharField(required=False, widget=CropExample())

    class Meta:
        model = Image

    def more_image(self):
        more_image = self.files.getlist('image')[:]
        if len(more_image) >= 2:
            del more_image[-1]
            return more_image
        return []<commit_msg>set field crop x/y Hidden Input on images forms<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django import forms

from .models import Image
from .widgets import MultipleUpload, CropExample


class ImageModelForm(forms.ModelForm):
    image = forms.FileField(required=True, widget=MultipleUpload())
    crop_example = forms.CharField(required=False, widget=CropExample())
    crop_x1 = forms.CharField(required=False, widget=forms.HiddenInput())
    crop_x2 = forms.CharField(required=False, widget=forms.HiddenInput())
    crop_y1 = forms.CharField(required=False, widget=forms.HiddenInput())
    crop_y2 = forms.CharField(required=False, widget=forms.HiddenInput())

    class Meta:
        model = Image

    def more_image(self):
        more_image = self.files.getlist('image')[:]
        if len(more_image) >= 2:
            del more_image[-1]
            return more_image
        return []
{'fraction_non_alphanumeric': 0.11666666666666667, 'fraction_numerical': 0.006666666666666667, 'mean_word_length': 3.4940119760479043, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7109185', 'n_tokens_mistral': 450, 'n_tokens_neox': 440, 'n_words': 102}