예제 #1
0
파일: apps.py 프로젝트: pombredanne/djpcms
class ModelLinksForm(forms.Form):
    size = forms.ChoiceField(choices=(('', 'standard'), (classes.button_large,
                                                         'large'),
                                      (classes.button_small, 'small')),
                             required=False)
    for_instance = forms.BooleanField()
    layout = forms.ChoiceField(choices=(('group left', 'group left'),
                                        ('group right', 'group right'),
                                        ('horizontal', 'horizontal'),
                                        ('vertical', 'vertical')))
    for_instance = forms.BooleanField()
    exclude = forms.CharField(max_length=600, required=False)
    include = forms.CharField(max_length=600, required=False)
예제 #2
0
파일: apps.py 프로젝트: pombredanne/djpcms
class ModelItemListForm(ForModelForm):
    max_display = forms.IntegerField(initial=10,
                                     widget=html.TextInput(cn='span1'))
    text_search = forms.CharField(required=False)
    filter = forms.CharField(required=False)
    exclude = forms.CharField(required=False)
    order_by = forms.ChoiceField(required=False,
                                 widget=html.Select(cn='model-fields'),
                                 choices=FieldChoices())
    descending = forms.BooleanField(initial=False)
    headers = forms.ChoiceField(required=False,
                                widget=html.Select(cn='model-fields'),
                                choices=FieldChoices(multiple=True))
    table_footer = forms.BooleanField(initial=False, label='footer')
    display_if_empty = forms.BooleanField(initial=False)
예제 #3
0
파일: forms.py 프로젝트: pombredanne/djpcms
class PageForm(forms.Form):
    '''Inline Editing Page form'''
    url = forms.CharField(initial='/')
    title = forms.CharField(label='Page title', required=False)
    link = forms.CharField(help_text='Text to display in links',
                           required=False)
    in_navigation = forms.IntegerField(
                        initial=0,
                        required=False,
                        label='position',
                        help_text="An integer greater or equal 0 used for "\
                                  " link ordering in menus. If zero the page "\
                                  "won't appear in naviagtions")
    layout = forms.ChoiceField(choices=get_layout_templates,
                               label='Page layout')
    inner_template = forms.ChoiceField(label='content grid',
                                       choices=grid_choices)
    grid_system = forms.ChoiceField(choices=grid_systems)
    soft_root = forms.BooleanField()
    doctype = forms.ChoiceField(choices=html_choices, initial=htmldefaultdoc)

    def clean_url(self, value):
        if self.mapper:
            try:
                page = self.mapper.get(url=value)
            except self.mapper.DoesNotExist:
                page = None
            if page and self.instance != page:
                raise forms.ValidationError('A page with url "{0}"\
 is already available'.format(value))
        else:
            raise forms.ValidationError('No page model defined.')
        return value
예제 #4
0
class UserChangeForm(forms.Form):
    '''A form for editing the user details. This assume that the user
model has the fields in this form.'''
    first_name = forms.CharField(required=False)
    last_name = forms.CharField(required=False)
    email_address = forms.CharField(required=False)
    is_superuser = forms.BooleanField()
    is_active = forms.BooleanField(initial=True)

    def __init__(self, **kwargs):
        super(UserChangeForm, self).__init__(**kwargs)
        if not self.is_bound:
            user = self.user
            if not user or not user.is_superuser:
                self.dfields['is_superuser'].widget.addClass('hidden')
                self.dfields['is_active'].widget.addClass('hidden')
예제 #5
0
파일: forms.py 프로젝트: smhjn/flow
class SecurityTradeForm(ManualTradeForm):
    dataid = forms.ModelChoiceField(DataId.objects, label='security')
    add_cash_trade = forms.BooleanField(initial=False, required=False)

    layout = FormLayout(
        Fieldset('dataid'),
        Fieldset('fund',
                 'open_date',
                 'quantity',
                 'price',
                 'add_cash_trade',
                 css_class=inlineLabels))

    class Meta:
        fields = ['fund', 'open_date', 'quantity', 'price']

    def save(self, commit=True):
        self.instance.dataid = self.cleaned_data['dataid']
        return super(SecurityTradeForm, self).save(commit=commit)
예제 #6
0
파일: forms.py 프로젝트: pombredanne/djpcms
class ContentBlockForm(forms.Form):
    '''Form for editing a content block within a page.'''
    url = forms.HiddenField(required=False)
    title = forms.CharField(required=False)
    plugin_name = PluginChoice(label='Plugin', choices=plugins.plugingenerator)
    container_type = forms.ChoiceField(
        label='Container',
        widget=html.Select(cn='ajax'),
        choices=plugins.wrappergenerator,
        help_text='A HTML element which wraps the plugin\
 before it is rendered in the page.')
    for_not_authenticated = forms.BooleanField(default=False)

    def on_submit(self, commit):
        data = self.cleaned_data
        pt = data.pop('plugin_name')
        instance = self.instance
        instance.plugin_name = pt.name if pt else ''
        if 'container_type' in data:
            instance.container_type = data['container_type']
예제 #7
0
파일: trade.py 프로젝트: smhjn/flow
class PortfolioForm(forms.Form):
    for_user = forms.BooleanField(initial=False, required=False)
예제 #8
0
파일: apps.py 프로젝트: pombredanne/djpcms
class FormModelForm(ForModelForm):
    method = forms.ChoiceField(choices=(('get', 'get'), ('post', 'post')),
                               initial='get')
    ajax = forms.BooleanField(initial=False)
예제 #9
0
파일: views.py 프로젝트: GunioRobot/dynts
class PlotSettings(forms.Form):
    line_fill = forms.BooleanField()
    bar_fill = forms.BooleanField()
예제 #10
0
class EcoForm(forms.Form):
    path = forms.CharField()
    default_show = forms.BooleanField(initial=True, required=False)
    height = forms.IntegerField()
예제 #11
0
class SearchModelForm(FormModelForm):
    autocomplete = forms.BooleanField()
    multiple = forms.BooleanField(initial=True)
    tooltip = forms.CharField(required=False, max_length=50)