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'))
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'))
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())
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())