def helper(self): helper = FormHelper() helper.error_text_inline = False helper.attrs = { 'autocomplete': 'off', 'autocorrect': 'off', 'autocapitalize': 'off', 'spellcheck': 'false', } # .sr-only class is for screen reader only (won't be shown visibly) # Refer to http://stackoverflow.com/a/27755704 for more explanation helper.label_class = 'sr-only' helper.layout = Layout( Fieldset( '', Field('email', placeholder=self.fields['email'].label), Field('password1', placeholder=self.fields['password1'].label), Field('password2', placeholder=self.fields['password2'].label), ), FormActions( Submit( 'save', _('Create Account'), css_class='btn-lg btn-block', ))) return helper
def get_context_data(self, **kwargs): # Get a list of users who are active CUED members seeking mentors seekers = get_user_model().objects.\ filter(cued_member__is_active=True, mentorship_preferences__is_seeking_mentor=True).\ select_related('cued_member', 'cued_member__research_group', 'cued_member__research_group__division') # We want to annotate each seeker with the number of active mentee # relationships they are currently a part of seekers = seekers.\ annotate(mentors_count=Coalesce(Sum( Case(When(mentee_relationships__is_active=True, then=Value(1)), When(mentee_relationships__is_active=False, then=Value(0)), output_field=IntegerField()) ), 0)) f = MatchmakeFilter(self.request.GET, queryset=seekers) helper = FormHelper(f.form) helper.html5_required = True helper.error_text_inline = False helper.form_action = "" helper.form_method = "get" helper.add_input(Submit("submit", "Update filter")) f.form.helper = helper table = MatchmakeTable(f.qs, order_by='crsid', empty_text='No people match this filter') tables.RequestConfig(self.request, paginate=False).configure(table) return {'table': table, 'filter': f}
def helper(self): helper = FormHelper() helper.error_text_inline = False helper.label_class = 'sr-only' helper.attrs = { 'autocomplete': 'off', 'autocorrect': 'off', 'autocapitalize': 'off', 'spellcheck': 'false', } helper.layout = Layout( Fieldset( '', Field('username', placeholder=self.fields['username'].label), Field('password', placeholder=self.fields['password'].label), ), FormActions(Div( Div( HTML(_( '<a class="btn btn-link" href="{password_reset_url}">' 'Forgot Password?</a>' ).format(password_reset_url=reverse('password_reset'))), css_class='col-xs-6 m-t-2', ), Div( Submit('save', _('Log In'), css_class='btn-lg btn-block'), css_class='col-xs-6', ), css_class='row', )) ) return helper
def get_context_data(self, **kwargs): # Get a list of users who are active CUED members seeking mentors seekers = get_user_model().objects.\ filter(cued_member__is_active=True, mentorship_preferences__is_seeking_mentor=True).\ select_related('cued_member', 'cued_member__research_group', 'cued_member__research_group__division') # We want to annotate each seeker with the number of active mentee # relationships they are currently a part of seekers = seekers.\ annotate(mentors_count=Coalesce(Sum( Case(When(mentee_relationships__is_active=True, then=Value(1)), When(mentee_relationships__is_active=False, then=Value(0)), output_field=IntegerField()) ), 0)) f = MatchmakeFilter(self.request.GET, queryset=seekers) helper = FormHelper(f.form) helper.html5_required = True helper.error_text_inline = False helper.form_action = "" helper.form_method = "get" helper.add_input(Submit("submit", "Update filter")) f.form.helper = helper table = MatchmakeTable( f.qs, order_by='crsid', empty_text='No people match this filter') tables.RequestConfig( self.request, paginate=False).configure(table) return {'table': table, 'filter': f}
def __init__(self, *args, **kwargs): h = FormHelper() h.form_id = 'user-profile-form' h.form_class = 'form-horizontal' h.label_class = 'col-lg-2' h.field_class = 'col-lg-4' h.layout = layout.Layout( 'theme', 'new_window', 'items_per_page', 'excluded_tags', 'show_excluded', layout.Div( layout.Div( layout.Submit('Save', value='Save', css_class='btn-default'), css_class='col-lg-offset-2 col-lg-4' ), css_class='form-group', ) ) h.help_text_inline = True h.error_text_inline = True h.html5_required = True self.helper = h super(UserProfileForm, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): h = FormHelper() h.form_id = 'item-search-form' h.form_method = 'GET' h.form_class = 'form-horizontal' h.label_class = 'col-lg-2' h.field_class = 'col-lg-8' h.layout = layout.Layout( 'q', layout.Div( layout.Div( layout.Button('Search', value='Search', css_class='btn-primary'), layout.Div( layout.HTML('<button id="id_oldest" class="btn btn-default" name="sort"' ' value="oldest" type="submit">' '<i class="fa fa-sort-asc"></i> Oldest first' '</button>'), layout.HTML('<button id="id_newest" class="btn btn-default" name="sort"' ' value="newest" type="submit">' '<i class="fa fa-sort-desc"></i> Newest first' '</button>'), css_class="pull-right"), css_class='col-lg-offset-2 col-lg-8' ), css_class='form-group', ) ) h.help_text_inline = True h.error_text_inline = True h.html5_required = True self.helper = h super(SearchForm, self).__init__(*args, **kwargs)
def helper(self): helper = FormHelper() helper.error_text_inline = False helper.label_class = 'sr-only' helper.attrs = { 'autocomplete': 'off', 'autocorrect': 'off', 'autocapitalize': 'off', 'spellcheck': 'false', } helper.layout = Layout( Fieldset( '', Field( 'new_password1', placeholder=self.fields['new_password1'].label, ), Field( 'new_password2', placeholder=self.fields['new_password2'].label, ), ), FormActions(Div( Div( Submit( 'submit', _('Set Password'), css_class='btn btn-primary btn-block btn-lg' ), css_class='col-md-offset-1 col-md-10', ), css_class='nesting-form-group row' )) ) return helper
def helper(self): helper = FormHelper() helper.error_text_inline = False helper.label_class = 'sr-only' helper.attrs = { 'autocomplete': 'off', 'autocorrect': 'off', 'autocapitalize': 'off', 'spellcheck': 'false', } helper.layout = Layout( Fieldset( '', Field( 'new_password1', placeholder=self.fields['new_password1'].label, ), Field( 'new_password2', placeholder=self.fields['new_password2'].label, ), ), FormActions( Div(Div( Submit('submit', _('Set Password'), css_class='btn btn-primary btn-block btn-lg'), css_class='col-md-offset-1 col-md-10', ), css_class='nesting-form-group row'))) return helper
def helper(self): helper = FormHelper() helper.error_text_inline = False helper.label_class = 'sr-only' helper.attrs = { 'autocomplete': 'off', 'autocorrect': 'off', 'autocapitalize': 'off', 'spellcheck': 'false', } helper.layout = Layout( Fieldset( '', Field('username', placeholder=self.fields['username'].label), Field('password', placeholder=self.fields['password'].label), ), FormActions( Div( Div( HTML( _('<a class="btn btn-link" href="{password_reset_url}">' 'Forgot Password?</a>').format( password_reset_url=reverse( 'password_reset'))), css_class='col-xs-6 m-t-2', ), Div( Submit('save', _('Log In'), css_class='btn-lg btn-block'), css_class='col-xs-6', ), css_class='row', ))) return helper
def get_helper(self): helper = FormHelper(self) helper.html5_required = True helper.error_text_inline = False helper.add_input( Submit('submit', self.Meta.submit_text), ) return helper
def __init__(self, *args, **kwargs): h = FormHelper() h.form_id = 'create-item-form' h.form_method = 'post' h.form_class = 'form-horizontal' h.help_text_inline = True h.error_text_inline = True h.html5_required = True h.add_input(Submit('submit', 'Submit')) self.helper = h super(CreateItemForm, self).__init__(*args, **kwargs)
def setup_boostrap_helpers(formtag=False): helper = FormHelper() helper.form_class = 'form-horizontal' helper.label_class = 'col-sm-2' helper.field_class = 'col-sm-10' helper.html5_required = True helper.form_show_labels = True helper.error_text_inline = True helper.help_text_inline = True helper.form_show_errors = True helper.form_tag = formtag return helper
def setup_boostrap_helpers(formtag=False): helper = FormHelper() helper.form_class = 'form-horizontal' #helper.label_class = 'col-sm-2' helper.field_class = 'col-sm-12' helper.html5_required = True helper.form_show_labels = False helper.error_text_inline = True helper.help_text_inline = True helper.render_required_fields = True helper.form_show_errors = True helper.form_tag = formtag return helper
def helper(self): helper = FormHelper() helper.error_text_inline = False helper.attrs = { 'autocomplete': 'off', 'autocorrect': 'off', 'autocapitalize': 'off', 'spellcheck': 'false', } helper.layout = Layout( Fieldset( '', Field('name', placeholder=self.fields['name'].label), ), FormActions(Submit('save', _('Update'), css_class=''), )) return helper
def helper(self): helper = FormHelper() helper.error_text_inline = False helper.attrs = { 'autocomplete': 'off', 'autocorrect': 'off', 'autocapitalize': 'off', 'spellcheck': 'false', } helper.layout = Layout( Fieldset( '', Field('name', placeholder=self.fields['name'].label), Field('auth_number'), ), FormActions( Submit('save', _('Update'), css_class=''), ) ) return helper
def helper(self): helper = FormHelper() helper.error_text_inline = False helper.attrs = { 'autocomplete': 'off', 'autocorrect': 'off', 'autocapitalize': 'off', 'spellcheck': 'false', } helper.label_class = 'sr-only' helper.layout = Layout( Fieldset( '', Field('email', placeholder=self.fields['email'].label), Field('password1', placeholder=self.fields['password1'].label), Field('password2', placeholder=self.fields['password2'].label), ), FormActions( Submit( 'save', _('Create Account'), css_class='btn-lg btn-block', ) ) ) return helper
def helper(self): helper = FormHelper() helper.error_text_inline = False helper.attrs = { 'autocomplete': 'off', 'autocorrect': 'off', 'autocapitalize': 'off', 'spellcheck': 'false', } # .sr-only class is for screen reader only (won't be shown visibly) # Refer to http://stackoverflow.com/a/27755704 for more explanation helper.label_class = 'sr-only' helper.layout = Layout( Fieldset( '', Field('email', placeholder=self.fields['email'].label), Field('password1', placeholder=self.fields['password1'].label), Field('password2', placeholder=self.fields['password2'].label), ), FormActions( Submit( 'save', _('Create Account'), css_class='btn-lg btn-block', ) ) ) return helper
def get_helper(self): helper = FormHelper(self) helper.html5_required = True helper.error_text_inline = False helper.add_input(Submit('submit', self.Meta.submit_text), ) return helper
# search_helper.label_class = 'col-lg-2' # search_helper.field_class = 'col-lg-6' search_helper.layout = Layout( Row(InlineField('name', css_class='form-control'), InlineField('author', css_class='form-control'), InlineField('pub', css_class='form-control'), FormActions( Submit('Save changes', value="Search", css_class="btn-info align-right"), ), css_class="text-center")) password_change_helper = FormHelper() password_change_helper.form_tag = True password_change_helper.form_class = 'form-horizontal' password_change_helper.form_show_labels = True password_change_helper.form_show_errors = True password_change_helper.error_text_inline = False password_change_helper.help_text_inline = False search_helper.label_class = 'col-lg-2' search_helper.field_class = 'col-lg-6' password_change_helper.layout = Layout( Div('old_password', 'new_password1', 'new_password2', FormActions( Submit('submit', value="Change Password", css_class="btn btn-default")), css_class="col-md-3"), )