Python crispy_forms.layout.Submit() Examples

The following are 30 code examples of crispy_forms.layout.Submit(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module crispy_forms.layout , or try the search function .
Example #1
Source File: filterset.py    From Dailyfresh-B2C with Apache License 2.0 6 votes vote down vote up
def form(self):
        form = super(FilterSet, self).form

        if compat.is_crispy():
            from crispy_forms.helper import FormHelper
            from crispy_forms.layout import Layout, Submit

            layout_components = list(form.fields.keys()) + [
                Submit('', _('Submit'), css_class='btn-default'),
            ]
            helper = FormHelper()
            helper.form_method = 'GET'
            helper.template_pack = 'bootstrap3'
            helper.layout = Layout(*layout_components)

            form.helper = helper

        return form 
Example #2
Source File: forms.py    From osler with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, *args, **kwargs):
        referral_location_qs = kwargs.pop('referral_location_qs', None)
        super(PatientContactForm, self).__init__(*args, **kwargs)
        if referral_location_qs is not None:
            self.fields['appointment_location'].queryset = referral_location_qs

        self.helper = FormHelper(self)
        self.helper.form_class = 'form-horizontal'
        self.helper.label_class = 'col-lg-2'
        self.helper.field_class = 'col-lg-8'

        self.helper.add_input(Submit(
            self.SUCCESSFUL_REFERRAL,
            'Save & mark successful referral',
            css_class='btn btn-success'))
        self.helper.add_input(Submit(
            self.REQUEST_FOLLOWUP,
            'Save & request future followup',
            css_class='btn btn-info'))
        self.helper.add_input(Submit(
            self.UNSUCCESSFUL_REFERRAL,
            'Save & do not follow up again',
            css_class='btn btn-danger btn-sm')) 
Example #3
Source File: forms.py    From TWLight with MIT License 6 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(SuggestionForm, self).__init__(*args, **kwargs)
        # Translators: This labels a textfield where users can enter the name of the potential partner they'll suggest
        self.fields["suggested_company_name"].label = _("Name of the potential partner")
        # Translators: This labels a textfield where users can enter the description of the potential partner they'll suggest
        self.fields["description"].label = _("Description")
        # Translators: This labels a textfield where users can enter the website URL of the potential partner they'll suggest
        self.fields["company_url"].label = _("Website")
        # @TODO: This sort of gets repeated in PartnerSuggestionView.
        # We could probably be factored out to a common place for DRYness.
        self.helper = FormHelper()
        self.helper.form_tag = False
        self.helper.form_class = "form-horizontal"
        self.helper.label_class = "col-lg-3"
        self.helper.field_class = "col-lg-7"
        self.helper.layout = Layout(
            "suggested_company_name",
            "description",
            "company_url",
            "next",
            # Translators: This labels a button which users click to submit their suggestion.
            Submit("submit", _("Submit"), css_class="center-block"),
        ) 
Example #4
Source File: forms.py    From osler with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, *args, **kwargs):

        super(ActionItemForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)

        self.helper.layout = Layout(
            Row(
                Column(css_class='form-group col-md-3 col-xs-4'),
                Column('due_date', css_class='form-group col-md-3 col-xs-4'),
                Column('instruction', css_class='form-group col-md-3 col-xs-4'),
                css_class='form-row'
            ),
            Row(
                Column(css_class='form-group col-md-3 col-xs-4'),
                Column('comments', css_class='form-group col-md-6 col-xs-6')
            ),
            CustomCheckbox('priority'),
            Row(
                Column(Submit('submit', 'Submit'),
                    css_class='formgroup col-md-offset-3 col-xs-offset-4')
            )
        )

        self.fields['instruction'].queryset = models.ActionInstruction.objects.filter(
            active=True) 
Example #5
Source File: forms.py    From osler with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(DemographicsForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_method = 'post'

        self.helper.layout = Layout(
                Fieldset('Medical',
                         'has_insurance',
                         'ER_visit_last_year',
                         'last_date_physician_visit',
                         'chronic_condition'),
                Fieldset('Social',
                         'lives_alone',
                         'dependents',
                         'resource_access',
                         'transportation'),
                Fieldset('Employment',
                         'currently_employed',
                         'education_level',
                         'work_status',
                         'annual_income')
        )

        self.helper.add_input(Submit('submit', 'Submit')) 
Example #6
Source File: views.py    From tom_base with GNU General Public License v3.0 6 votes vote down vote up
def get_form(self):
        form = super().get_form()
        form.fields['facility'].widget = forms.HiddenInput()
        form.fields['observation_id'].widget = forms.HiddenInput()
        if self.request.method == 'GET':
            target_id = self.request.GET.get('target_id')
        elif self.request.method == 'POST':
            target_id = self.request.POST.get('target_id')
        cancel_url = reverse('home')
        if target_id:
            cancel_url = reverse('tom_targets:detail', kwargs={'pk': target_id})
        form.helper.layout = Layout(
            HTML('''<p>An observation record already exists in your TOM for this combination of observation ID,
                 facility, and target. Are you sure you want to create this record?</p>'''),
            'target_id',
            'facility',
            'observation_id',
            'confirm',
            FormActions(
                Submit('confirm', 'Confirm'),
                HTML(f'<a class="btn btn-outline-primary" href={cancel_url}>Cancel</a>')
            )
        )
        return form 
Example #7
Source File: forms.py    From pyconapac-2016 with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(TutorialProposalForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_method = 'post'
        self.helper.add_input(Submit('submit', _('Submit'))) 
Example #8
Source File: forms.py    From pyconapac-2016 with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(SpeakerForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_method = 'post'
        self.helper.add_input(Submit('submit', _('Submit')))
        self.fields['image'].help_text += _('Maximum size is %d MB') \
            % settings.SPEAKER_IMAGE_MAXIMUM_FILESIZE_IN_MB
        self.fields['image'].help_text += ' / ' + _('Minimum dimension is %d x %d') \
            % settings.SPEAKER_IMAGE_MINIMUM_DIMENSION 
Example #9
Source File: forms.py    From pyconapac-2016 with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(ProgramForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_method = 'post'
        self.helper.add_input(Submit('submit', _('Submit'))) 
Example #10
Source File: forms.py    From pyconapac-2016 with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(ProposalForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_method = 'post'
        self.helper.add_input(Submit('submit', _('Submit'))) 
Example #11
Source File: forms.py    From swarfarm with Apache License 2.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(CrispyPasswordResetForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_method = 'post'
        self.helper.form_action = 'password_reset'
        self.helper.layout = Layout(
            Field('email'),
            FormActions(Submit('submit', 'Submit', css_class='btn-lg btn-primary btn-block')),
        ) 
Example #12
Source File: forms.py    From Django-Design-Patterns-and-Best-Practices-Second-Edition with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        submit_btn_name = kwargs.pop('submit_btn_name', 'subscribe_butn')
        submit_btn_value = kwargs.pop('submit_btn_value', 'Subscribe')

        super().__init__(*args, **kwargs)
        self.helper = FormHelper(self)
        self.helper.layout.append(Submit(name=submit_btn_name,
                                         value=submit_btn_value)) 
Example #13
Source File: forms.py    From Django-2-Web-Development-Cookbook-Third-Edition with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_action = ""
        self.helper.form_method = "POST"
        self.helper.layout = layout.Layout(
            layout.Field("title"),
            layout.Field(
                "categories",
                template="utils/checkbox_multi_select_tree.html"),
            bootstrap.FormActions(
                layout.Submit("submit", _("Save")),
            )
        ) 
Example #14
Source File: forms.py    From Django-2-Web-Development-Cookbook-Third-Edition with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_action = ""
        self.helper.form_method = "POST"
        self.helper.layout = layout.Layout(
            layout.Field("title"),
            layout.Field(
                "categories",
                template="utils/checkbox_multi_select_tree.html"),
            bootstrap.FormActions(
                layout.Submit("submit", _("Save")),
            )
        ) 
Example #15
Source File: forms.py    From Django-2-Web-Development-Cookbook-Third-Edition with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_action = ""
        self.helper.form_method = "POST"
        self.helper.layout = layout.Layout(
            layout.Field("title"),
            layout.Field(
                "categories",
                template="utils/checkbox_multi_select_tree.html"),
            bootstrap.FormActions(
                layout.Submit("submit", _("Save")),
            )
        ) 
Example #16
Source File: forms.py    From Django-Design-Patterns-and-Best-Practices-Second-Edition with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        vip = kwargs.pop("vip", False)
        super().__init__(*args, **kwargs)

        # Are you a VIP?
        if vip:
            self.fields["first_class"] = forms.BooleanField(
                label="Fly First Class?",
                required=False,
                initial=True,
                help_text="First-class only offered to VIPs")

        self.helper = FormHelper(self)
        self.helper.layout.append(Submit('submit', 'Submit')) 
Example #17
Source File: forms.py    From swarfarm with Apache License 2.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(CrispyAuthenticationForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_method = 'post'
        self.helper.form_action = 'login'
        self.helper.layout = Layout(
            Field('username'),
            Field('password'),
            Hidden('next', value='{{ next }}'),
            FormActions(Submit('login', 'Log In', css_class='btn-lg btn-primary btn-block')),
        ) 
Example #18
Source File: forms.py    From pyconkr-2014 with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(SpeakerForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.add_input(Submit('submit', _('Submit'))) 
Example #19
Source File: forms.py    From pyconapac-2016 with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(EmailLoginForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_method = 'post'
        self.helper.add_input(Submit('submit', _('Login'))) 
Example #20
Source File: forms.py    From Learning-Path-Learn-Web-Development-with-Python with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.helper = FormHelper(self)
        self.helper.layout.append(Submit('save', 'Save')) 
Example #21
Source File: forms.py    From Learning-Path-Learn-Web-Development-with-Python with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        submit_btn_name = kwargs.pop('submit_btn_name', 'subscribe_butn')
        submit_btn_value = kwargs.pop('submit_btn_value', 'Subscribe')

        super().__init__(*args, **kwargs)
        self.helper = FormHelper(self)
        self.helper.layout.append(Submit(name=submit_btn_name,
                                         value=submit_btn_value)) 
Example #22
Source File: forms.py    From Learning-Path-Learn-Web-Development-with-Python with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        vip = kwargs.pop("vip", False)
        super().__init__(*args, **kwargs)

        # Are you a VIP?
        if vip:
            self.fields["first_class"] = forms.BooleanField(
                label="Fly First Class?",
                required=False,
                initial=True,
                help_text="First-class only offered to VIPs")

        self.helper = FormHelper(self)
        self.helper.layout.append(Submit('submit', 'Submit')) 
Example #23
Source File: forms.py    From matterllo with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(WebhookCreateForm, self).__init__(*args, **kwargs)
        helper = self.helper = FormHelper()

        layout = helper.layout = Layout()
        layout.append(Field('name', placeholder='webhook for town-square'))
        layout.append(Field('incoming_webhook_url', placeholder='https://mattermost.gitlab.com/hooks/b5g6pyoqsjy88fa6kzn7xi1rzy'))
        layout.append(FormActions(Submit('save', 'Next')))

        helper.form_show_labels = False
        helper.form_class = 'form-horizontal'
        helper.field_class = 'col-lg-8'
        helper.help_text_inline = True 
Example #24
Source File: forms.py    From matterllo with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(BridgeCreateForm, self).__init__(*args, **kwargs)
        helper = self.helper = FormHelper()

        layout = helper.layout = Layout()
        layout.append(Field('events', css_class='board-event'))
        layout.append(FormActions(HTML('<button class="btn btn-info" type="button" onclick="document.querySelectorAll(\'.board-event\').forEach(x => x.checked = true);">Check all</button>')))
        layout.append(FormActions(HTML('<button class="btn btn-info" type="button" onclick="document.querySelectorAll(\'.board-event\').forEach(x => x.checked = false);">Uncheck all</button>')))
        layout.append(FormActions(Submit('save', 'Save')))

        helper.form_show_labels = False
        helper.form_class = 'form-horizontal'
        helper.field_class = 'col-lg-8'
        helper.help_text_inline = True 
Example #25
Source File: forms.py    From bootstrap-forms-example with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_method = 'post'
        self.helper.add_input(Submit('submit', 'Save person')) 
Example #26
Source File: forms.py    From pets with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(UsersPasswordResetForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.add_input(Submit("recover", _("Recover password"))) 
Example #27
Source File: forms.py    From pets with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(UsersPasswordRecoveryForm, self).__init__(*args, **kwargs)
        self.fields["username_or_email"].label = ""
        self.helper = FormHelper()
        self.helper.add_input(Submit("recover", _("Recover password"))) 
Example #28
Source File: forms.py    From pets with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(UpdateUserForm, self).__init__(*args, **kwargs)
        self.helper.add_input(Submit("submit", _("Save Changes"))) 
Example #29
Source File: forms.py    From memex-explorer with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def set_layout(self):
        """Called in __init__ to register a custom layout."""

        self.helper.layout = Layout(
            Fieldset(
                None,
                'name',
                'description',
                FormActions(Submit('submit', "Submit")),
            )
        ) 
Example #30
Source File: forms.py    From memex-explorer with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def set_layout(self):
        """Called in __init__ to register a custom layout."""
        self.helper.layout = Layout(
            Fieldset(None,
                'name',
                'description',
                'seeds_list',
                HTML(
                '''
                    <label for="id_textseeds" class="">
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        Or, paste  urls to crawl.
                    </label>
                    <div class="controls ">
                        <textarea class="textarea form-control"
                            cols="10"
                            id="id_textseeds"
                            name="textseeds"
                            rows="10">
                        </textarea>
                    </div>
                    <br>
                '''
                ),
                InlineRadios('crawler'),
                "rounds_left",
                'crawl_model',
                FormActions(Submit('submit', "Create")),
                HTML(
                """
                    <a class="add_index btn btn-primary link-button"
                        id="cancelSubmit"
                        target="_blank"
                        href="#">
                        Cancel
                    </a>
                """
                ),
            )
        )