コード例 #1
0
def test_form_settings_can_be_iterated_as_choices(settings):
    settings.FP_FORM_BLOCK_CHOICES = {}
    config = BlockFormSettings()
    config.update({'default': {'name': 'The Default'}})
    config.update({'test': {'name': 'Another form'}})

    assert tuple(config.as_choices()) == (('default', 'The Default'),
                                          ('test', 'Another form'))
コード例 #2
0
def test_form_settings_can_be_iterated_as_choices(settings):
    settings.FP_FORM_BLOCK_CHOICES = {}
    config = BlockFormSettings()
    config.update({'default': {'name': 'The Default'}})
    config.update({'test': {'name': 'Another form'}})

    assert tuple(config.as_choices()) == (('default', 'The Default'),
                                          ('test', 'Another form'))
コード例 #3
0
ファイル: forms.py プロジェクト: commoncode/django-fancypages
 def __init__(self, *args, **kwargs):
     super(FormBlockForm, self).__init__(*args, **kwargs)
     from fancypages.helpers import BlockFormSettings
     settings = BlockFormSettings()
     self.fields['form_selection'].choices = tuple(settings.as_choices())
コード例 #4
0
ファイル: forms.py プロジェクト: aibon/django-fancypages
 def __init__(self, *args, **kwargs):
     super(FormBlockForm, self).__init__(*args, **kwargs)
     from fancypages.helpers import BlockFormSettings
     settings = BlockFormSettings()
     self.fields['form_selection'].choices = tuple(settings.as_choices())