Exemple #1
0
        for key, config in self.config.items():
            try:
                process = cfg[key]['process']
            except KeyError:
                # ignore configs without process methods
                continue

            ret[key] = process(model_instance=self,
                               form_instance=form,
                               request=request,
                               config=config)

        return ret


FIELD_TYPES = utils.get_object(settings.FORM_DESIGNER_FIELD_TYPES)


@python_2_unicode_compatible
class FormField(models.Model):
    form = models.ForeignKey(Form,
                             related_name='fields',
                             verbose_name=_('form'))
    ordering = models.IntegerField(_('ordering'), default=0)

    title = models.CharField(_('title'), max_length=100)
    name = models.CharField(_('name'), max_length=100)
    type = models.CharField(_('type'),
                            max_length=20,
                            choices=[r[:2] for r in FIELD_TYPES])
    choices = models.CharField(_('choices'),
def get_type_choices():
    return [r[:2] for r in
            get_object(settings.FORM_DESIGNER_FIELD_TYPES)]
Exemple #3
0
            try:
                process = cfg[key]['process']
            except KeyError:
                # ignore configs without process methods
                continue

            ret[key] = process(
                model_instance=self,
                form_instance=form,
                request=request,
                config=config)

        return ret


FIELD_TYPES = utils.get_object(settings.FORM_DESIGNER_FIELD_TYPES)


@python_2_unicode_compatible
class FormField(models.Model):
    form = models.ForeignKey(Form, related_name='fields',
        verbose_name=_('form'))
    ordering = models.IntegerField(_('ordering'), default=0)

    title = models.CharField(_('title'), max_length=100)
    name = models.CharField(_('name'), max_length=100)
    type = models.CharField(
        _('type'), max_length=20, choices=[r[:2] for r in FIELD_TYPES])
    choices = models.CharField(
        _('choices'), max_length=1024, blank=True,
        help_text=_('Comma-separated'))
Exemple #4
0
def get_type_choices():
    return [r[:2] for r in get_object(settings.FORM_DESIGNER_FIELD_TYPES)]