<commit_before># coding=utf-8

from django import forms
from django.forms import widgets

from feedback.models import Person, Veranstaltung, Kommentar, BarcodeScannEvent
from django.core.exceptions import ValidationError

from feedback.models import Semester


class BestellWizardForm(forms.ModelForm):
    required_css_class = 'required'

class VeranstaltungEvaluationForm(BestellWizardForm):
    """Definiert die Form für den 1. Schritt des Wizards"""

    class Meta:
        model = Veranstaltung
        fields = ('evaluieren',)
        widgets = {'evaluieren': forms.RadioSelect}

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

        for k, field in list(self.fields.items()):
            field.required = not(Semester.current().vollerhebung)


class VeranstaltungBasisdatenForm(BestellWizardForm):
    """Definiert die Form für den 2. Schritt des Wizards."""

    def __init__(self, *args, **kwargs):
        veranstalter_queryset = kwargs.pop('all_veranstalter', None)

        super(VeranstaltungBasisdatenForm, self).__init__(*args, **kwargs)<commit_msg>fix submit form if vollerhebung<commit_after># coding=utf-8

from django import forms
from django.forms import widgets

from feedback.models import Person, Veranstaltung, Kommentar, BarcodeScannEvent
from django.core.exceptions import ValidationError

from feedback.models import Semester


class BestellWizardForm(forms.ModelForm):
    required_css_class = 'required'

class VeranstaltungEvaluationForm(BestellWizardForm):
    """Definiert die Form für den 1. Schritt des Wizards"""

    class Meta:
        model = Veranstaltung
        fields = ('evaluieren',)
        widgets = {'evaluieren': forms.RadioSelect}

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

        for k, field in list(self.fields.items()):
            if not(Semester.current().vollerhebung):
                field.required = True

    def clean(self):
        cleaned_data = super().clean()
        if Semester.current().vollerhebung:
            cleaned_data['evaluieren'] = True
        return cleaned_data

class VeranstaltungBasisdatenForm(BestellWizardForm):
    """Definiert die Form für den 2. Schritt des Wizards."""

    def __init__(self, *args, **kwargs):
        veranstalter_queryset = kwargs.pop('all_veranstalter', None)

        super(VeranstaltungBasisdatenForm, self).__init__(*args, **kwargs)
{'fraction_non_alphanumeric': 0.10108303249097472, 'fraction_numerical': 0.0024067388688327317, 'mean_word_length': 3.9484126984126986, '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': '7281680', 'n_tokens_mistral': 769, 'n_tokens_neox': 752, 'n_words': 183}