Пример #1
0
class TransForm(Form):

    description = CharField(widget=TextWidget(60),
                            max_length=255,
                            required=False,
                            label='Popis')

    transaction_type = ChoiceField(widget=RadioWidget(),
                                   choices=TR_OPTS,
                                   label='Typ',
                                   initial='balance')

    date = DateField(widget=DateWidget(today=True), label='Datum')

    amount = DecimalField(widget=TextWidget(15),
                          max_digits=15,
                          decimal_places=2,
                          min_value=.0,
                          required=False,
                          label='Částka',
                          localize=True)

    repayment_preference = ChoiceField(widget=RadioWidget(),
                                       choices=REP_OPTS,
                                       required=False,
                                       label='Přednost',
                                       initial='interest')

    def clean_amount(self):
        data = self.cleaned_data['amount']
        if self.data['transaction_type'] != 'balance' and not data:
            raise ValidationError('Amount is required')
        return data
Пример #2
0
class ProcForm(Form):

    court = CharField(widget=CourtWidget(supreme_court=True,
                                         supreme_administrative_court=True),
                      max_length=30,
                      label='Soud',
                      initial=SUPREME_COURT,
                      validators=(courtval, ))

    senate = IntegerField(widget=TextWidget(8),
                          min_value=0,
                          initial='',
                          required=False)

    register = CharField(widget=TextWidget(8),
                         max_length=30,
                         initial='',
                         validators=(RegexValidator(regex=REGISTER_RE_STR), ))

    number = IntegerField(widget=TextWidget(8), min_value=1, initial='')

    year = IntegerField(widget=TextWidget(8), min_value=1990, initial='')

    desc = CharField(widget=TextWidget(60),
                     max_length=255,
                     label='Popis',
                     required=False)
Пример #3
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.fields['username'].label = 'Uživatelské jméno'
     self.fields['username'].help_text = '(pouze písmena, číslice a znaky @/./+/-/_)'
     self.fields['username'].widget = TextWidget(20)
     self.fields['first_name'].required = True
     self.fields['first_name'].label = 'Jméno'
     self.fields['first_name'].widget = TextWidget(20)
     self.fields['last_name'].required = True
     self.fields['last_name'].label = 'Příjmení'
     self.fields['last_name'].widget = TextWidget(20)
     self.fields['password1'].label = 'Heslo'
     self.fields['password1'].widget = PasswordWidget(20)
     self.fields['password1'].help_text = '(nejméně {:d} znaků)'.format(MIN_PWLEN)
     self.fields['password2'].label = 'Potvrzení hesla'
     self.fields['password2'].help_text = '(zadejte heslo znovu, pro kontrolu)'
     self.fields['password2'].widget = PasswordWidget(20)
     self.fields['email'].label = 'E-mail'
     self.fields['email'].help_text = '(nepovinný)'
     self.fields['email'].widget = TextWidget(20)
     del self.fields['password']
     del self.fields['is_staff']
     del self.fields['is_active']
     del self.fields['is_superuser']
     del self.fields['last_login']
     del self.fields['date_joined']
     del self.fields['groups']
     del self.fields['user_permissions']
Пример #4
0
class InsForm(Form):

    number = IntegerField(widget=TextWidget(8), min_value=1, initial='')

    year = IntegerField(widget=TextWidget(8), min_value=2008, initial='')

    desc = CharField(widget=TextWidget(60), max_length=255, label='Popis')

    detailed = BooleanField(initial=True,
                            label='Všechny události',
                            required=False)
Пример #5
0
class FXform(Form):

    currency_from = CharField(widget=CurrencyWidget(),
                              min_length=3,
                              max_length=3)
    del currency_from.widget.attrs['minlength']

    currency_to = CharField(widget=CurrencyWidget(),
                            min_length=3,
                            max_length=3)
    del currency_to.widget.attrs['minlength']

    rate_from = FloatField(widget=TextWidget(6),
                           min_value=.001,
                           localize=True,
                           initial=1)

    rate_to = FloatField(widget=TextWidget(6),
                         min_value=.001,
                         localize=True,
                         initial=1)

    date_from = DateField(widget=DateWidget(), required=False)

    date_to = DateField(widget=DateWidget(), required=False)

    def clean_currency_from(self):
        data = self.cleaned_data['currency_from'].upper()
        if not CURRENCY_RE.match(data):
            raise ValidationError('Invalid currency format')
        if data == self.data['currency_to'].upper():
            raise ValidationError('Currencies must be different')
        return data

    def clean_currency_to(self):
        data = self.cleaned_data['currency_to'].upper()
        if not CURRENCY_RE.match(data):
            raise ValidationError('Invalid currency format')
        if data == self.data['currency_from'].upper():
            raise ValidationError('Currencies must be different')
        return data

    def clean(self):
        cleaned_data = super().clean()
        date_from = cleaned_data.get('date_from', None)
        date_to = cleaned_data.get('date_to', None)
        if date_from and date_to and date_from > date_to:
            msg = 'Invalid interval'
            self._errors['date_from'] = self.error_class([msg])
            self._errors['date_to'] = self.error_class([msg])
            del cleaned_data['date_from']
            del cleaned_data['date_to']
        return cleaned_data
Пример #6
0
class CreditForm(Form):

    description = CharField(widget=TextWidget(50),
                            max_length=50,
                            required=False,
                            label='Popis')

    date = DateField(widget=DateWidget(), label='Datum')

    amount = AmountField(widget=TextWidget(15),
                         min_value=.01,
                         label='Částka',
                         localize=True)

    currency = CurrencyField(label='Měna', initial='CZK')
Пример #7
0
class PartyForm(Form):

    party = CharField(
        widget=TextWidget(50),
        max_length=MAX_LENGTH,
        min_length=MIN_LENGTH,
        label='Vyhledávací řetězec',
        validators=(MinLengthValidator(MIN_LENGTH),))

    party_opt = ChoiceField(
        widget=RadioWidget(),
        choices=TEXT_OPTS,
        label='Posice',
        initial='icontains')

    check_psj = InlineBooleanField(
        initial=True,
        required=False,
        label='soudní jednání')

    check_uds = InlineBooleanField(
        initial=True,
        required=False,
        label='úřední desky')

    check_udn = InlineBooleanField(
        initial=True,
        required=False,
        label='úřední desku NSS')
Пример #8
0
class MainForm(Form):

    basis = AmountField(widget=TextWidget(15),
                        min_value=1,
                        label='Základ',
                        localize=True)
    basis.rounding = 2

    curr = CurrencyField(label='Měna', czk=True, initial='CZK')

    today = date.today()
    fx_date = DateField(widget=DateWidget(),
                        required=False,
                        label='ke dni',
                        initial=date(today.year, today.month, 1))

    model = CharField(label='Úprava', initial='4')

    opt = ChoiceField(widget=RadioWidget(),
                      choices=OPTS,
                      label='Zvláštní případy',
                      initial='none')

    def clean_fx_date(self):
        data = self.cleaned_data['fx_date']
        if self.data['curr_0'] != 'CZK' and not data:
            raise ValidationError('Date is required')
        return data
Пример #9
0
class MainForm(Form):

    beg_date = DateField(widget=DateWidget(today=True),
                         label='Počátek',
                         validators=(MinValueValidator(MIN_DATE),
                                     MaxValueValidator(MAX_DATE)),
                         initial=date.today)

    dur = IntegerField(widget=TextWidget(4),
                       validators=(MinValueValidator(MIN_DUR),
                                   MaxValueValidator(MAX_DUR)),
                       required=False)

    unit = CharField(required=False)

    preset = ChoiceField(widget=RadioWidget(),
                         choices=PRESETS,
                         label='Délka',
                         initial='none')

    def clean_dur(self):
        data = self.cleaned_data['dur']
        if 'submit_set_beg_date' not in self.data and self.data[
                'preset'] == 'none' and data is None:
            raise ValidationError('Duration may not be empty')
        return data
Пример #10
0
class BalanceForm(Form):

    description = CharField(widget=TextWidget(50),
                            max_length=50,
                            required=False,
                            label='Popis')

    date = DateField(widget=DateWidget(today=True), label='Datum')
Пример #11
0
class UserAddForm(UserChangeForm, UserCreationForm, Form):

    captcha = CharField(
        widget=TextWidget(20),
        label='Kontrolní otázka',
        help_text='Jak se jmenuje hlavní město České republiky?')

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.fields['username'].label = 'Uživatelské jméno'
        self.fields['username'].help_text = '(pouze písmena, číslice a znaky @/./+/-/_)'
        self.fields['username'].widget = TextWidget(20)
        self.fields['first_name'].required = True
        self.fields['first_name'].label = 'Jméno'
        self.fields['first_name'].widget = TextWidget(20)
        self.fields['last_name'].required = True
        self.fields['last_name'].label = 'Příjmení'
        self.fields['last_name'].widget = TextWidget(20)
        self.fields['password1'].label = 'Heslo'
        self.fields['password1'].widget = PasswordWidget(20)
        self.fields['password1'].help_text = '(nejméně {:d} znaků)'.format(MIN_PWLEN)
        self.fields['password2'].label = 'Potvrzení hesla'
        self.fields['password2'].help_text = '(zadejte heslo znovu, pro kontrolu)'
        self.fields['password2'].widget = PasswordWidget(20)
        self.fields['email'].label = 'E-mail'
        self.fields['email'].help_text = '(nepovinný)'
        self.fields['email'].widget = TextWidget(20)
        del self.fields['password']
        del self.fields['is_staff']
        del self.fields['is_active']
        del self.fields['is_superuser']
        del self.fields['last_login']
        del self.fields['date_joined']
        del self.fields['groups']
        del self.fields['user_permissions']

    def clean_username(self):
        username = self.cleaned_data['username']
        if User.objects.filter(username=username):
            raise ValidationError('Duplicate username')
        return username

    def clean_captcha(self):
        captcha = self.cleaned_data['captcha']
        if captcha.lower() != 'praha':
            raise ValidationError('Wrong answer')
        return captcha

    def clean(self):
        cleaned_data = super().clean()
        if self.cleaned_data.get('password1', '') != self.cleaned_data.get('password2', ''):
            msg = 'Different passwords'
            self._errors['password1'] = self.error_class([msg])
            self._errors['password2'] = self.error_class([msg])
            raise ValidationError('Different passwords')
        return cleaned_data
Пример #12
0
class MainForm(Form):

    beg_date = DateField(widget=DateWidget(), label='Nástup trestu')

    years = IntegerField(widget=TextWidget(4),
                         required=False,
                         min_value=0,
                         label='let')

    months = IntegerField(widget=TextWidget(4),
                          required=False,
                          min_value=0,
                          label='měsíců')

    days = IntegerField(widget=TextWidget(4),
                        required=False,
                        min_value=0,
                        label='dnů')

    def clean_years(self):
        data = self.cleaned_data['years']
        if not (data or self.data['months'] or self.data['days']):
            raise ValidationError('Missing duration')
        return data

    def clean_months(self):
        data = self.cleaned_data['months']
        if not (data or self.data['years'] or self.data['days']):
            raise ValidationError('Missing duration')
        return data

    def clean_days(self):
        data = self.cleaned_data['days']
        if not (data or self.data['years'] or self.data['months']):
            raise ValidationError('Missing duration')
        return data
Пример #13
0
class MainForm(Form):

    curr = CurrencyField(czk=False, label='Měna', initial='EUR')

    fx_date = DateField(widget=DateWidget(today=True),
                        label='ke dni',
                        initial=date.today)

    basis = AmountField(widget=TextWidget(15),
                        min_value=.01,
                        label='Základ',
                        localize=True)

    mpi_date = DateField(widget=DateWidget(today=True),
                         label='Ke dni',
                         initial=date.today)
Пример #14
0
class MainForm(Form):

    title = CharField(widget=TextWidget(60),
                      max_length=255,
                      required=False,
                      label='Popis')

    note = CharField(widget=TextAreaWidget(), required=False, label='Poznámka')

    internal_note = CharField(widget=TextAreaWidget(),
                              required=False,
                              label='Interní poznámka')

    rounding = CharField(label='Zaokrouhlení')

    next = CharField(widget=HiddenWidget(), required=False)

    def clean_note(self):
        return self.cleaned_data['note'].replace('\r', '')

    def clean_internal_note(self):
        return self.cleaned_data['internal_note'].replace('\r', '')
Пример #15
0
class MainForm(Form):

    title = CharField(widget=TextWidget(60),
                      max_length=255,
                      required=False,
                      label='Popis')

    note = CharField(widget=TextAreaWidget(), required=False, label='Poznámka')

    internal_note = CharField(widget=TextAreaWidget(),
                              required=False,
                              label='Interní poznámka')

    currency = CurrencyField(label='Měna', initial='CZK')

    rounding = CharField(label='Zaokrouhlení')

    model = ChoiceField(widget=RadioWidget(),
                        choices=INT_OPTS,
                        label='Úročení')

    fixed_amount = DecimalField(widget=TextWidget(15),
                                max_digits=15,
                                decimal_places=2,
                                min_value=0.0,
                                required=False,
                                localize=True)

    pa_rate = DecimalField(widget=TextWidget(15),
                           max_digits=12,
                           decimal_places=6,
                           required=False,
                           localize=True)

    ydconv = CharField(label='Konvence', required=False)

    pm_rate = DecimalField(widget=TextWidget(15),
                           max_digits=12,
                           decimal_places=6,
                           required=False,
                           localize=True)

    mdconv = CharField(label='Konvence', required=False)

    pd_rate = DecimalField(widget=TextWidget(15),
                           max_digits=12,
                           decimal_places=6,
                           required=False,
                           localize=True)

    next = CharField(widget=HiddenWidget(), required=False)

    def clean_note(self):
        return self.cleaned_data['note'].replace('\r', '')

    def clean_internal_note(self):
        return self.cleaned_data['internal_note'].replace('\r', '')

    def clean_fixed_amount(self):
        data = self.cleaned_data['fixed_amount']
        if self.data['model'] == 'fixed' and not data:
            raise ValidationError('Amount is required')
        return data

    def clean_pa_rate(self):
        data = self.cleaned_data['pa_rate']
        if self.data['model'] == 'per_annum' and not data:
            raise ValidationError('Interest rate is required')
        return data

    def clean_pm_rate(self):
        data = self.cleaned_data['pm_rate']
        if self.data['model'] == 'per_mensem' and not data:
            raise ValidationError('Interest rate is required')
        return data

    def clean_pd_rate(self):
        data = self.cleaned_data['pd_rate']
        if self.data['model'] == 'per_diem' and not data:
            raise ValidationError('Interest rate is required')
        return data
Пример #16
0
class DebitForm(Form):

    description = CharField(widget=TextWidget(50),
                            max_length=50,
                            required=False,
                            label='Popis')

    fixed_amount = AmountField(widget=TextWidget(15),
                               min_value=.01,
                               required=False,
                               localize=True)

    fixed_currency = CurrencyField(label='v měně', initial='CZK')

    fixed_date = DateField(widget=DateWidget(),
                           required=False,
                           label='Splatnost')

    principal_debit = IntegerField(required=False, label='Z')

    principal_amount = AmountField(widget=TextWidget(15),
                                   min_value=.01,
                                   required=False,
                                   label='Částka',
                                   localize=True)

    principal_currency = CurrencyField(label='v měně', initial='CZK')

    date_from = DateField(widget=DateWidget(), required=False, label='Od')

    date_to = DateField(widget=DateWidget(), required=False, label='Do')

    model = ChoiceField(widget=RadioWidget(),
                        choices=DEB_OPTS,
                        initial='fixed')

    pa_rate = FloatField(widget=TextWidget(15),
                         min_value=0.0,
                         required=False,
                         localize=True)

    ydconv = CharField(label='Konvence', required=False)

    pm_rate = FloatField(widget=TextWidget(15),
                         min_value=0.0,
                         required=False,
                         localize=True)

    mdconv = CharField(label='Konvence', required=False)

    pd_rate = FloatField(widget=TextWidget(15),
                         min_value=0.0,
                         required=False,
                         localize=True)

    lock_fixed = BooleanField(widget=HiddenWidget(), required=False)

    def clean_fixed_amount(self):
        data = self.cleaned_data['fixed_amount']
        if self.data['model'] == 'fixed' and not data:
            raise ValidationError('Amount is required')
        return data

    def clean_fixed_currency(self):
        data = self.cleaned_data['fixed_currency']
        if self.data['model'] == 'fixed' and not data:
            raise ValidationError('Currency is required')
        return data

    def clean_fixed_date(self):
        data = self.cleaned_data['fixed_date']
        if self.data['model'] == 'fixed' and not data:
            raise ValidationError('Date is required')
        return data

    def clean_principal_amount(self):
        data = self.cleaned_data['principal_amount']
        if self.data['model'] != 'fixed' and self.cleaned_data[
                'principal_debit'] == 0 and not data:
            raise ValidationError('Principal amount is required')
        return data

    def clean_principal_currency(self):
        data = self.cleaned_data['principal_currency']
        if self.data['model'] != 'fixed' and self.cleaned_data[
                'principal_debit'] == 0 and not data:
            raise ValidationError('Principal currency is required')
        return data

    def clean_date_from(self):
        data = self.cleaned_data['date_from']
        if self.data['model'] != 'fixed' and self.cleaned_data[
                'principal_debit'] == 0 and not data:
            raise ValidationError('Starting date is required')
        return data

    def clean_pa_rate(self):
        data = self.cleaned_data['pa_rate']
        if self.data['model'] == 'per_annum' and not data:
            raise ValidationError('Interest rate is required')
        return data

    def clean_pm_rate(self):
        data = self.cleaned_data['pm_rate']
        if self.data['model'] == 'per_mensem' and not data:
            raise ValidationError('Interest rate is required')
        return data

    def clean_pd_rate(self):
        data = self.cleaned_data['pd_rate']
        if self.data['model'] == 'per_diem' and not data:
            raise ValidationError('Interest rate is required')
        return data

    def clean(self):
        cleaned_data = super().clean()
        date_from = cleaned_data.get('date_from', None)
        date_to = cleaned_data.get('date_to', None)
        if date_from and date_to and date_from > date_to:
            msg = 'Invalid interval'
            self._errors['date_from'] = self.error_class([msg])
            self._errors['date_to'] = self.error_class([msg])
            del cleaned_data['date_from']
            del cleaned_data['date_to']
        return cleaned_data
Пример #17
0
class LostPwForm(Form):

    username = CharField(
        widget=TextWidget(15),
        max_length=150,
        label='Uživatelské jméno')
Пример #18
0
class MainForm(Form):

    date_from = DateField(widget=DateWidget(), required=False)

    date_to = DateField(widget=DateWidget(), required=False)

    court = CharField(widget=CourtWidget(supreme_administrative_court=True),
                      max_length=255,
                      required=False,
                      label='Soud')

    senate = IntegerField(widget=TextWidget(8),
                          min_value=0,
                          initial='',
                          required=False)

    register = CharField(widget=TextWidget(8),
                         max_length=30,
                         validators=(RegexValidator(regex=REGISTER_RE_STR), ),
                         initial='',
                         required=False)

    number = IntegerField(widget=TextWidget(8),
                          min_value=1,
                          initial='',
                          required=False)

    year = IntegerField(widget=TextWidget(8),
                        min_value=1,
                        initial='',
                        required=False)

    courtroom = CharField(max_length=255,
                          required=False,
                          label='Jednací síň',
                          initial='')

    judge = CharField(max_length=255,
                      required=False,
                      label='Řešitel',
                      initial='')

    party = CharField(widget=TextWidget(50),
                      required=False,
                      max_length=255,
                      label='Účastník řízení')

    party_opt = ChoiceField(widget=RadioWidget(),
                            choices=TEXT_OPTS,
                            initial='icontains')

    format = ChoiceField(widget=RadioWidget(),
                         choices=FORMAT_OPTS,
                         label='Výstupní formát',
                         initial='html')

    def clean(self):
        cleaned_data = super().clean()
        date_from = cleaned_data.get('date_from', None)
        date_to = cleaned_data.get('date_to', None)
        if date_from and date_to and date_from > date_to:
            msg = 'Invalid interval'
            self._errors['date_from'] = self.error_class([msg])
            self._errors['date_to'] = self.error_class([msg])
            del cleaned_data['date_from']
            del cleaned_data['date_to']
        return cleaned_data
Пример #19
0
class DebtorForm(Form):

    curr_year = date.today().year

    desc = CharField(widget=TextWidget(50), max_length=255, label='Popis')

    court = CharField(widget=CourtWidget(ins_courts=True),
                      max_length=255,
                      required=False,
                      label='Insolvenční soud',
                      initial='')

    name = CharField(widget=TextWidget(50),
                     max_length=MAX_LENGTH,
                     required=False,
                     label='Příjmení/název')

    name_opt = ChoiceField(widget=RadioWidget(),
                           choices=TEXT_OPTS,
                           label='Posice',
                           initial='icontains')

    first_name = CharField(widget=TextWidget(50),
                           max_length=MAX_LENGTH,
                           required=False,
                           label='Jméno')

    first_name_opt = ChoiceField(widget=RadioWidget(),
                                 choices=TEXT_OPTS,
                                 label='Posice',
                                 initial='icontains')

    genid = CharField(widget=TextWidget(20),
                      required=False,
                      max_length=9,
                      validators=(RegexValidator(regex=IC_RE_STR), ),
                      label='IČO')

    taxid = CharField(widget=TextWidget(20),
                      required=False,
                      max_length=14,
                      label='DIČ')

    birthid = CharField(widget=TextWidget(20),
                        required=False,
                        max_length=11,
                        validators=(RegexValidator(regex=RC_FULL_RE_STR), ),
                        label='Rodné číslo')

    date_birth = DateField(widget=DateWidget(),
                           required=False,
                           label='Datum narození')

    year_birth_from = IntegerField(widget=TextWidget(4),
                                   min_value=1900,
                                   max_value=curr_year,
                                   initial='',
                                   required=False)

    year_birth_to = IntegerField(widget=TextWidget(4),
                                 min_value=1900,
                                 max_value=curr_year,
                                 initial='',
                                 required=False)

    def clean(self):
        cleaned_data = super().clean()
        year_birth_from = cleaned_data.get('year_birth_from', None)
        year_birth_to = cleaned_data.get('year_birth_to', None)
        if year_birth_from and year_birth_to and year_birth_from > year_birth_to:
            msg = 'Invalid interval'
            self._errors['year_birth_from'] = self.error_class([msg])
            self._errors['year_birth_to'] = self.error_class([msg])
            del cleaned_data['year_birth_from']
            del cleaned_data['year_birth_to']
        return cleaned_data
Пример #20
0
class MainForm(Form):

    court = CharField(widget=CourtWidget(ins_courts=True),
                      max_length=255,
                      required=False,
                      label='Insolvenční soud',
                      initial='')

    senate = IntegerField(widget=TextWidget(8),
                          min_value=0,
                          initial='',
                          required=False)

    number = IntegerField(widget=TextWidget(8),
                          min_value=1,
                          initial='',
                          required=False)

    year = IntegerField(widget=TextWidget(8),
                        min_value=2008,
                        initial='',
                        required=False)

    date_first_from = DateField(widget=DateWidget(), required=False)

    date_first_to = DateField(widget=DateWidget(), required=False)

    date_last_from = DateField(widget=DateWidget(), required=False)

    date_last_to = DateField(widget=DateWidget(), required=False)

    name = CharField(widget=TextWidget(35),
                     required=False,
                     max_length=255,
                     label='Příjmení/název')

    name_opt = ChoiceField(widget=RadioWidget(),
                           choices=TEXT_OPTS,
                           initial='istartswith')

    first_name = CharField(widget=TextWidget(35),
                           required=False,
                           max_length=255,
                           label='Jméno')

    first_name_opt = ChoiceField(widget=RadioWidget(),
                                 choices=TEXT_OPTS,
                                 initial='istartswith')

    city = CharField(widget=TextWidget(35),
                     required=False,
                     max_length=255,
                     label='Obec')

    city_opt = ChoiceField(widget=RadioWidget(),
                           choices=TEXT_OPTS,
                           initial='istartswith')

    genid = CharField(widget=TextWidget(20),
                      required=False,
                      max_length=9,
                      validators=(RegexValidator(regex=IC_RE_STR), ),
                      label='IČO')

    taxid = CharField(widget=TextWidget(20),
                      required=False,
                      max_length=14,
                      label='DIČ')

    birthid = CharField(widget=TextWidget(20),
                        required=False,
                        max_length=11,
                        validators=(RegexValidator(regex=RC_FULL_RE_STR), ),
                        label='Rodné číslo')

    date_birth = DateField(widget=DateWidget(),
                           required=False,
                           label='Datum narození')

    year_birth_from = IntegerField(widget=TextWidget(4),
                                   min_value=1900,
                                   max_value=CURRYEAR,
                                   initial='',
                                   required=False)

    year_birth_to = IntegerField(widget=TextWidget(4),
                                 min_value=1900,
                                 max_value=CURRYEAR,
                                 initial='',
                                 required=False)

    role_debtor = InlineBooleanField(initial=True,
                                     required=False,
                                     label='dlužník')

    role_trustee = InlineBooleanField(required=False, label='správce')

    role_creditor = InlineBooleanField(required=False, label='věřitel')

    deleted = InlineBooleanField(required=False, label='včetně vyškrtnutých')

    creditors = InlineBooleanField(required=False,
                                   label='včetně seznamu věřitelů')

    format = ChoiceField(widget=RadioWidget(),
                         choices=FORMAT_OPTS,
                         label='Výstupní formát',
                         initial='html')

    def clean(self):
        cleaned_data = super().clean()
        date_first_from = cleaned_data.get('date_first_from', None)
        date_first_to = cleaned_data.get('date_first_to', None)
        if date_first_from and date_first_to and date_first_from > date_first_to:
            msg = 'Invalid interval'
            self._errors['date_first_from'] = self.error_class([msg])
            self._errors['date_first_to'] = self.error_class([msg])
            del cleaned_data['date_first_from']
            del cleaned_data['date_first_to']
        date_last_from = cleaned_data.get('date_last_from', None)
        date_last_to = cleaned_data.get('date_last_to', None)
        if date_last_from and date_last_to and date_last_from > date_last_to:
            msg = 'Invalid interval'
            self._errors['date_last_from'] = self.error_class([msg])
            self._errors['date_last_to'] = self.error_class([msg])
            del cleaned_data['date_last_from']
            del cleaned_data['date_last_to']
        year_birth_from = cleaned_data.get('year_birth_from', None)
        year_birth_to = cleaned_data.get('year_birth_to', None)
        if year_birth_from and year_birth_to and year_birth_from > year_birth_to:
            msg = 'Invalid interval'
            self._errors['year_birth_from'] = self.error_class([msg])
            self._errors['year_birth_to'] = self.error_class([msg])
            del cleaned_data['year_birth_from']
            del cleaned_data['year_birth_to']
        return cleaned_data
Пример #21
0
class MainForm(Form):

    date_posted_from = DateField(
        widget=DateWidget(),
        required=False)

    date_posted_to = DateField(
        widget=DateWidget(),
        required=False)

    publisher = CharField(
        widget=PublisherWidget(),
        max_length=255,
        required=False,
        label='Soud/státní zastupitelství')

    senate = IntegerField(
        widget=TextWidget(8),
        min_value=0,
        initial='',
        required=False)

    register = CharField(
        widget=TextWidget(8),
        max_length=30,
        initial='',
        required=False)

    number = IntegerField(
        widget=TextWidget(8),
        min_value=1,
        initial='',
        required=False)

    year = IntegerField(
        widget=TextWidget(8),
        min_value=1950,
        initial='',
        required=False)

    page = IntegerField(
        widget=TextWidget(8),
        min_value=1,
        initial='',
        required=False)

    agenda = CharField(
        max_length=255,
        required=False,
        label='Agenda',
        initial='')

    text = CharField(
        widget=TextWidget(60),
        required=False,
        max_length=255,
        label='V textu',
        validators=(SphinxQueryValidator(),))

    format = ChoiceField(
        widget=RadioWidget(),
        choices=FORMAT_OPTS,
        label='Výstupní formát',
        initial='html')

    def clean(self):
        cleaned_data = super().clean()
        date_posted_from = cleaned_data.get('date_posted_from', None)
        date_posted_to = cleaned_data.get('date_posted_to', None)
        if date_posted_from and date_posted_to and date_posted_from > date_posted_to:
            msg = 'Invalid interval'
            self._errors['date_posted_from'] = self.error_class([msg])
            self._errors['date_posted_to'] = self.error_class([msg])
            del cleaned_data['date_posted_from']
            del cleaned_data['date_posted_to']
        return cleaned_data
Пример #22
0
class MainForm(Form):

    netincome = AmountField(widget=TextWidget(8),
                            min_value=0,
                            label='Čistá mzda',
                            localize=True)
    netincome.rounding = 0

    netincome2 = AmountField(widget=TextWidget(8),
                             min_value=0,
                             localize=True,
                             initial=0)
    netincome2.rounding = 0

    partner = BooleanField(required=False,
                           label='Manžel/manželka',
                           initial=False)

    partner2 = BooleanField(required=True, initial=True, disabled=True)

    deps = IntegerField(widget=TextWidget(8),
                        min_value=0,
                        label='Počet dalších vyživovaných osob',
                        initial=0)

    deps2 = IntegerField(widget=TextWidget(8), min_value=0, initial=0)

    subs = AmountField(widget=TextWidget(8),
                       min_value=0,
                       label='Zákonné životní minimum',
                       localize=True,
                       initial=getpreset('SUBS', as_func=True))
    subs.rounding = 0

    apt = AmountField(widget=TextWidget(8),
                      min_value=0,
                      label='Normativní náklady na bydlení',
                      localize=True,
                      initial=getpreset('APT', as_func=True))
    apt.rounding = 0

    fee = AmountField(widget=TextWidget(8),
                      min_value=0,
                      label='Měsíční odměna správce',
                      localize=True,
                      initial=getpreset('FEE', as_func=True))
    fee.rounding = 0

    fee2 = AmountField(widget=TextWidget(8),
                       min_value=0,
                       localize=True,
                       initial=getpreset('FEE2', as_func=True))
    fee2.rounding = 0

    exp = AmountField(widget=TextWidget(8),
                      min_value=0,
                      label='Měsíční hotové výdaje správce',
                      localize=True,
                      initial=getpreset('EXP', as_func=True))
    exp.rounding = 0

    exp2 = AmountField(widget=TextWidget(8),
                       min_value=0,
                       label='Měsíční hotové výdaje správce',
                       localize=True,
                       initial=getpreset('EXP2', as_func=True))
    exp2.rounding = 0

    vat = BooleanField(required=False,
                       label='Správce je plátcem DPH',
                       initial=True)

    vatrate = DecimalField(widget=TextWidget(8),
                           max_digits=4,
                           decimal_places=2,
                           min_value=0,
                           label='Sazba DPH z odměny správce',
                           initial=getpreset('VAT', as_func=True),
                           localize=True)
Пример #23
0
class EmailForm(Form):

    email = EmailField(widget=TextWidget(35), max_length=60, label='E-mail')