예제 #1
0
 def test_assigning_template_name(self):
     fieldset1 = Fieldset('the_name', fields=['a'])
     self.assertIsNone(fieldset1.template_name)
     fieldset2 = Fieldset('the_name',
                          fields=['a'],
                          template_name='some_custom_template.html')
     self.assertEqual(fieldset2.template_name, 'some_custom_template.html')
예제 #2
0
 class Meta:
     model = Forecast
     fieldsets = (
         Fieldset('', (
             Fieldset('', (
             ('label',),
             ('start_date',), 
             ('color_code',),
             ('comment',),
         )),
         )),
     )
예제 #3
0
 class Meta:
     fields = ['bezeichner', 'strasse', 'hausnummer', 'plz', 'stadt']
     model = Adresse
     fieldsets = (Fieldset('adresse',
                           fields=('bezeichner', 'strasse', 'hausnummer',
                                   'plz', 'stadt'),
                           legend='Adresse'), )
예제 #4
0
 class Meta(object):
     fieldsets = (
         Fieldset('main',
                  fields=('time', 'time_by_agreement', 'comment',
                          'restrictions', 'rrule')),
         Fieldset('repeat', fields=('repeat_type', )),
         Fieldset('rule d', fields=('interval_daily', )),
         Fieldset('rule w', fields=('interval_weekly', 'repeat_weeklyday')),
         Fieldset('rule mday mdate', fields=('interval_monthly', )),
         Fieldset('rule yday ydate',
                  fields=('interval_yearly', 'repeat_yearly_month')),
         Fieldset('rule mday yday', fields=('repeat_monthlyday', )),
         Fieldset('rule mdate ydate', fields=('repeat_monthlydate', )),
         Fieldset('freq_type', fields=('freq_type', )),
         Fieldset('freq c', fields=('freq_count', )),
     )
예제 #5
0
 def test_nested_fieldset(self):
     fields = ('a', ('b', 'c'), 'd')
     fieldset = Fieldset('the_name', fields=fields)
     self.assertTupleEqual(flatten_to_tuple(fields), fieldset.fields)
     iterated = tuple(iter(fieldset))
     self.assertEqual(iterated[0], 'a')
     self.assertTupleEqual(iterated[1].fields, ('b', 'c'))
     self.assertEqual(iterated[2], 'd')
예제 #6
0
 def test_named_nested_fieldset(self):
     fields = ('a', ('sub_name', {'fields': ('b', 'c')}), 'd')
     fieldset = Fieldset('the_name', fields=fields)
     self.assertTupleEqual(fieldset.fields, ('a', 'b', 'c', 'd'))
     fieldsets = tuple(iter(fieldset))
     self.assertEqual(fieldsets[0], 'a')
     self.assertTupleEqual(fieldsets[1].fields, ('b', 'c'))
     self.assertEqual(fieldsets[1].name, 'sub_name')
     self.assertEqual(fieldsets[2], 'd')
 class Meta:
     fields = ['wochentag', 'beginn', 'ende']
     model = FesteSchicht
     liste = ['auauauaua', 2, 3]
     fieldsets = (Fieldset(
         'feste_schicht',
         fields=('wochentag', 'beginn', 'ende'),
         legend='Feste Schicht hinzufügen',
         template_name="assistenten/fieldset_feste_schichten.html",
         liste=liste), )
예제 #8
0
    class Meta:
        fields = ['bezeichner', 'beginn', 'ende']
        model = SchichtTemplate

        fieldsets = (Fieldset(
            'schicht_template',
            fields=('bezeichner', 'beginn', 'ende'),
            legend='Schicht-Vorlage hinzufügen',
            template_name="assistenten/fieldset_schicht_templates.html",
        ), )
 class Meta:
     fields = [
         'kuerzel',
         'name',
         'vorname',
         'email',
         'einsatzbuero',
         'pflegefachkraft',
         'einsatzbegleitung']
     model = ASN
     fieldsets = (
         Fieldset('info', fields=(
             'kuerzel',
             'name',
             'vorname',
             'email'), legend='Stammdaten'),
         Fieldset('verbindungen', fields=(
             'einsatzbuero',
             'einsatzbegleitung',
             'pflegefachkraft'), legend='Zuordnung'),
     )
예제 #10
0
    class Meta:
        model = Partner
        fields = [
            'club','username','password','photo','member_since', 'email', 'is_superuser', 'is_staff', 'is_approved', 'is_active',
            'first_name', 'last_name', 'doc_id', 'birth_date', 'gender', 'rh', 'phone', 'address',
            'occupation', 'work_phone','work_address','emergency_contact','emergency_phone','have_disease','disease_name','observations',
            'dni_support', 'reference_letter', 'request_letter', 'release_letter', 'eps_affiliation', 'legal_records', 'bank_deposit',
        ]

        widgets={
            'club': forms.Select(attrs={'class':'form-control'}),
            'username':forms.TextInput(attrs={'class':'form-control'}),
            'password':forms.PasswordInput(attrs={'class':'form-control'}),
            'photo':forms.FileInput(attrs={'class':'form-control'}),
            'member_since': forms.TextInput(attrs={'class':'form-control'}),
            'email':forms.EmailInput(attrs={'class':'form-control'}),
            'is_active': forms.CheckboxInput(attrs={'class':'access-hide'}),
            'is_superuser':forms.CheckboxInput(attrs={'class':'access-hide'}),
            'is_staff':forms.CheckboxInput(attrs={'class':'access-hide'}),
            'is_approved':forms.CheckboxInput(attrs={'class':'access-hide'}),
            'rh':forms.Select(attrs={'class':'form-control'}),
            'first_name':forms.TextInput(attrs={'class':'form-control'}),
            'last_name':forms.TextInput(attrs={'class':'form-control'}),
            'doc_id':forms.NumberInput(attrs={'class':'form-control'}),
            'birth_date':forms.TextInput(attrs={'class':'form-control'}),
            'gender':forms.widgets.Select(choices=Partner.GENDERS, attrs={'class':'form-control'}),
            'phone': forms.TextInput(attrs={'class':'form-control'}),
            'address': forms.TextInput(attrs={'class':'form-control'}),
            'occupation': forms.TextInput(attrs={'class':'form-control'}),
            'work_phone': forms.TextInput(attrs={'class':'form-control'}),
            'work_address': forms.TextInput(attrs={'class':'form-control'}),
            'emergency_contact': forms.TextInput(attrs={'class':'form-control'}),
            'emergency_phone': forms.TextInput(attrs={'class':'form-control'}),
            'have_disease': forms.CheckboxInput(attrs={'class':'access-hide'}),
            'disease_name': forms.TextInput(attrs={'class':'form-control'}),
            'observations': forms.Textarea(attrs={'class':'form-control', 'rows':5, 'cols':39}),
            'dni_support': forms.FileInput(attrs={'class':'form-control'}),
            'reference_letter': forms.FileInput(attrs={'class':'form-control'}),
            'request_letter': forms.FileInput(attrs={'class':'form-control'}),
            'release_letter': forms.FileInput(attrs={'class':'form-control'}),
            'eps_affiliation': forms.FileInput(attrs={'class':'form-control'}),
            'legal_records': forms.FileInput(attrs={'class':'form-control'}),
            'bank_deposit': forms.FileInput(attrs={'class':'form-control'}),
        }

        labels = {
            'is_staff': 'Administrador', 'is_superuser': '******'
        }

        fieldsets = (

            Fieldset('cuenta', fields=(
                'club','photo','username','password','email','member_since','is_superuser','is_staff','is_active','is_approved'
            ), legend=u'1. Información de la cuenta'),

            Fieldset('personal', fields=(
                'first_name', 'last_name', 'doc_id', 'birth_date', 'gender', 'rh','phone',
                'address','occupation', 'work_phone','work_address'
            ), legend=u'2. Información personal'),

            Fieldset('additional', fields=(
                'emergency_contact','emergency_phone','have_disease',
                'disease_name','observations'
            ), legend=u'3. Información adicional'),

            Fieldset('soportes', fields=(
                'dni_support', 'reference_letter', 'request_letter', 'release_letter',
                'eps_affiliation', 'legal_records', 'bank_deposit',
            ), legend=u'4. Soportes'),
        )
예제 #11
0
    def test_nonzero_fieldset(self):
        fieldset1 = Fieldset('the_name', fields=[])
        self.assertFalse(fieldset1)

        fieldset2 = Fieldset('the_name', fields=['a'])
        self.assertTrue(fieldset2)
예제 #12
0
 def test_fieldset_as_row_item(self):
     fields = ('a', Fieldset('sub_name', fields=['b', 'c']))
     fieldset = Fieldset('the_name', fields=fields)
     self.assertTupleEqual(fieldset.fields, ('a', 'b', 'c'))
예제 #13
0
 def test_deeply_nested_fieldsets(self):
     fields = ('a', ('b', 'c'), 'd', ('e', ('f', 'g', ('h', )), 'i'))
     fieldset = Fieldset('the_name', fields=fields)
     self.assertTupleEqual(flatten_to_tuple(fields), fieldset.fields)
예제 #14
0
 class Meta:
     fieldsets = (
         Fieldset('first', ('a', 'b'), legend='First Fieldset'),
         Fieldset('second', ('c'), legend='Second Fieldset'),
     )
예제 #15
0
 def test_basic_fieldset(self):
     fields = ('a', 'b', 'c')
     fieldset = Fieldset('the_name', fields=fields)
     self.assertEqual(fieldset.name, 'the_name')
     self.assertTupleEqual(fields, fieldset.fields)