Esempio n. 1
0
 def __init__(self, *args, **kwargs):
     super(AdminAccountEditForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_method = 'POST'
     self.helper.layout = Layout(
         Div(Div(Field(
             'email',
             css_class='input-sm',
         ),
                 Field('first_name', css_class='input_sm'),
                 Field('second_name', css_class='input_sm'),
                 Field('group'),
                 Field('is_active', template='account/select.html'),
                 Field('password1', css_class='input-sm'),
                 Field('password2', css_class='input-sm'),
                 FormActions(Submit('submit',
                                    'Сохранить',
                                    css_class='btn-primary'),
                             css_class=''),
                 css_class='col-6'),
             Div(Field(
                 HTML(
                     '<img src="{{ object.avatar.url }}" style="width: 200px; height:200px;" class="mb-3"/>'
                     '<p><small>Максимальный размер картинки 400х400px</small></p>'
                 ), 'avatar'),
                 css_class='col-6 text-center'),
             css_class='row'))
Esempio n. 2
0
class CustomLoginForm(LoginForm):
    """Custom login form."""

    helper = FormHelper()
    helper.form_tag = False
    helper.layout = Layout(
        Div(Field('login', css_class="input100"),
            HTML("""<span class="focus-input100"></span>"""),
            css_class="wrap-input100 validate-input m-b-20"),
        Div(Field('password', css_class="input100"),
            HTML("""<span class="focus-input100"></span>"""),
            css_class="wrap-input100 validate-input m-b-20"))

    def __init__(self, *args, **kwargs):
        """Custom login form.

        Args:
            *args (TYPE): Description
            **kwargs (TYPE): Description
        """
        super(CustomLoginForm, self).__init__(*args, **kwargs)
        self.fields['login'].widget.attrs['autocomplete'] = 'email'
        self.fields['password'].widget.attrs['autocomplete'] = 'password'

    def login(self, request, redirect_url=None):
        """Login function of form."""
        ret = super(CustomLoginForm, self).login(request, redirect_url)
        return ret
Esempio n. 3
0
 def __init__(self, *args, **kwargs):
     super(AccountEditForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_method = 'POST'
     self.helper.layout = Layout(
         Div(Div(Field(
             'email',
             css_class='input-sm',
         ),
                 Field('first_name', css_class='input_sm'),
                 Field('second_name', css_class='input_sm'),
                 HTML("<div>Роли:</div>"
                      "{% for group in object.groups.all %}"
                      "<div class='ml-2'> {{ group.name }} </div>"
                      "{% endfor %}"),
                 Field('password1', css_class='input-sm'),
                 Field('password2', css_class='input-sm'),
                 FormActions(Submit('submit',
                                    'Сохранить',
                                    css_class='btn-primary'),
                             css_class=''),
                 css_class='col-6'),
             Div(Field(
                 HTML(
                     '<img src="{{ object.avatar.url }}" style="width: 200px; height:200px;" class="mb-3"/>'
                     '<p><small>Максимальный размер картинки 400х400px</small></p>'
                 ), 'avatar'),
                 css_class='col-6 text-center'),
             css_class='row'))
Esempio n. 4
0
    def __init__(self, placeholder, form_action,
                 act_search_type_label_var_name, search_key_values_var_name,
                 *args, **kwargs):
        super(GeneralSearchForm, self).__init__(*args, **kwargs)

        self.fields['search_param'].widget.attrs['placeholder'] = placeholder

        self.helper = FormHelper()
        self.helper.form_method = 'POST'
        self.helper.form_action = form_action
        self.helper.layout = Layout(
            Div(Div(Submit('submit', 'Search', css_class='btn'),
                    HTML("""
                        <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"
                                aria-haspopup="true" aria-expanded="false">
                            <span id="search_type_label">{{""" +
                         act_search_type_label_var_name + """}}</span>
                            <span class="caret"></span>
                        </button>
                        <ol id="search_type_list" class="dropdown-menu">
                            {% for key, value in """ +
                         search_key_values_var_name + """.items %}
                            <li id="search_type_item_{{ key }}">
                                <a href="#" onclick="change_search_type('{{ key }}', '{{ value }}', 'search_type_item_{{ key }}')">{{ value }}</a>
                            </li>
                            {% empty %}
                                <li>NONE</li>
                            {% endfor %}
                        </ol>
                    """),
                    css_class='input-group-btn'),
                'search_param',
                css_class='input-group'),
            'search_type',
        )
Esempio n. 5
0
    def __init__(self, *args, **kwargs):

        user = kwargs.pop('user')
        super(PropertyMaintenanceForm, self).__init__(*args, **kwargs)
        vh = kwargs.pop('instance')
        if not user.has_perm('fleet.authorize_vehiclemaintenance'):
            self.fields["authorize"].widget = HiddenInput()

        # self.fields['service_booking_number'].queryset = ServiceBooking.objects.filter(vehicle=vh.vehicle)
        self.helper = FormHelper(self)
        self.helper.layout = Layout(
            Fieldset(
                'Property Maintenance Details',
                Div('branch',
                    'maint_date',
                    'maintenance_type',
                    'invoice_number',
                    'service_provider',
                    'status',
                    css_class="col-sm-6"),
                Div('description',
                    'projected_cost',
                    'actual_cost',
                    'difference',
                    css_class="col-sm-6"),
                Div(css_class="col-sm-6"),
                Div('accept', css_class="col-sm-2"),
                Div('authorize', css_class="col-sm-4"),
            ))
Esempio n. 6
0
class BlogPostForm(forms.ModelForm):
    helper = FormHelper()
    # helper.form_tag = False

    helper.layout = Layout(
        _('Create a blog post'),
        Field('published'),
        Field('title'),
        Field('description'),
        Field('post_date'),
        Field('language'),
        Field('content'),
        Div(HTML("""
                <div class="btn-group" role="group" aria-label="...">
                  <button type="button" id="italics-btn" title="{0}" class="btn btn-inverse"> <span class="glyphicon glyphicon-italic"></span> </button>
                  <button type="button" id="bold-btn" title="{1}" class="btn btn-inverse"> <span class="glyphicon glyphicon-bold"></span> </button>
                  <button type="button" id="list-btn" title="{2}" class="btn btn-inverse"> <span class="glyphicon glyphicon-list"></span> </button>
                  <button type="button" id="link-btn" title="{3}" class="btn btn-inverse"> <span class="glyphicon glyphicon-link"></span> </button>
                  <button type="button" id="picture-btn" title="{4}" class="btn btn-inverse" data-toggle="modal" data-target="#upload-img-modal"> <span class="glyphicon glyphicon-picture"></span> </button>
                </div>
            """.format(trans("Insert italics code"),
                       trans("Insert bold text code"),
                       trans("Insert a list item"), trans("Insert a link"),
                       trans("Upload picture"))),
            css_class="pull-left"),
        Div(FormActions(Submit('save', _('Save')), ), css_class="pull-right"),
    )

    class Meta:
        model = Post
        fields = '__all__'
Esempio n. 7
0
    def __init__(self, *args, **kwargs):
        user = kwargs.pop('user')
        super(LeaseAgreementForm, self).__init__(*args, **kwargs)
        instance = kwargs.pop('instance')
        if not user.has_perm('fleet.authorize_vehiclemaintenance'):
            self.fields["authorize"].widget = HiddenInput()

        # self.fields['service_booking_number'].queryset = ServiceBooking.objects.filter(vehicle=instance.vehicle)
        self.helper = FormHelper(self)
        self.helper.layout = Layout(
            Fieldset(
                'Property Lease Agreement Details',
                Div('branch',
                    'current_leasee',
                    'leasor',
                    'contact_person',
                    'lease_expiry_date',
                    'notice_term',
                    'status',
                    css_class="col-sm-6"),
                Div('rental_amount',
                    'deposit',
                    HTML('<br/>'),
                    'surety',
                    'surety_deposit',
                    'electricity_deposit',
                    'electricity',
                    HTML('<br/>'),
                    'exit_clause_sent',
                    HTML('<br/>'),
                    css_class="col-sm-6"),
                Div(css_class="col-sm-6"),
                Div('accept', css_class="col-sm-2"),
                Div('authorize', css_class="col-sm-4"),
            ))
Esempio n. 8
0
    def __init__(self,  *args, **kwargs):
        super(RequisitionForm, self).__init__(*args, **kwargs)
        self.fields["requisition_type"].widget = HiddenInput() 
        self.helper = FormHelper(self)
        self.helper.layout = Layout(
            Fieldset(
                'Requisition',

                Div(
                    'vehicle',
                    'driver',
                    'requested_by',  
                    'quotation_1', 
                    'quotation_2', 
                    'supplier',                    
                                                                         
                    css_class = "col-md-6"),
                Div(
                    'requisition_type',
                                      
                    'description',
                    'mortivation', 
                    'amount',
                    'budgeted', 
                    'vat_included',                                     
                    css_class = "col-md-6"),
             
                )
            )
Esempio n. 9
0
    def __init__(self,  *args, **kwargs):
        user = kwargs.pop('user')
        super(VehicleAllocationForm, self).__init__(*args, **kwargs)
        
        if not user.has_perm('fleet.authorize_vehicleallocation'):
            self.fields["authorize"].widget = HiddenInput()  
        self.helper = FormHelper(self)       
        self.helper.layout = Layout(
            Fieldset(
                'Vehicle Allocation Details',

                Div('vehicle', 
                     'driver',
                    'transaction_type',
                    'allocation_date',                 
                    'mileage',
                    'status',
                    'accept',
                    'authorize',                       
                   
                    css_class = "col-md-4"), 
                 Div(
                    HTML(" {% include 'carallocations.html' %}"),
                    css_class = "col-md-8"), 

                )
            )
        self.fields['driver'].widget.attrs['onchange'] = 'validate_driver(this)'
Esempio n. 10
0
    def __init__(self, *args, **kwargs):        
        user = kwargs.pop('user')
        super(CardAllocationForm, self).__init__(*args, **kwargs)
        if not user.has_perm('fleet.authorize_vehiclemaintenance'):
            self.fields["authorize"].widget = HiddenInput()  
        
        # self.fields['service_booking_number'].queryset = ServiceBookings.objects.filter(vehicle=instance.vehicle)
        self.helper = FormHelper(self)
        self.helper.layout = Layout(
            Fieldset(
                'Card Allocation Details',

                Div(
                	'employee',
                	'allocation_date',
                	'allocation_type',
                    'mobile_number',                                    
                    'parckage', 
                    'fuel_card',                   
                    'fuel_cycle_limit',
                    'accept',
                	'authorize',
                css_class = "col-sm-3"),
               Div(
                    HTML(" {% include 'cardallocations.html' %}"),
                    css_class = "col-sm-9")
             
             
                )
            )
Esempio n. 11
0
class VehicleExtrasForm(forms.ModelForm):
    helper = FormHelper()
    helper.form_tag = False
    helper.layout = Layout(
        TabHolder(
            Tab(
                'Vehicle Description',
                Div(
                    'model_type', 'make_n_model', 'air_conditioner', 'turbo', 'sunroof', 'alloy_wheels',
                    css_class = "col-md-6"
                    ),
                Div(
                    'canopy', 'leather_seats', 'keyless_entry', 'anti_bracking_system', 'airbag', 'dual_airbag',
                    css_class = "col-md-6"
                    ),
                Div(
                    'long_base', 'power_windows', 'power_steering', 'power_mirros', 'anti_theft', 'electronic_fuel_injection',
                    css_class = "col-md-6"
                    )       
                ),                  
            )
        )
    class Meta:
        model = VehicleExtras
        fields = '__all__'
Esempio n. 12
0
class CustomSignupForm(SignupForm):
    """Custom login form.

    Attributes:
        first_name (TYPE): Description
        helper (TYPE): Description
        last_name (TYPE): Description
    """

    first_name = forms.CharField(
        max_length=50, label=_('First name'),
        widget=forms.TextInput(attrs={'placeholder': _('First name')})
    )
    last_name = forms.CharField(
        max_length=50, label=_('Last name'),
        widget=forms.TextInput(attrs={'placeholder': _('Last name')})
    )

    helper = FormHelper()
    helper.html5_required = True
    helper.form_tag = False
    helper.layout = Layout(
        Div(
            'email',
            'password1',
            'password2',
            css_class='col-md-4',

        ),
        Div(
            'first_name',
            'last_name',
            css_class='col-md-4',
        ),
    )

    def __init__(self, *args, **kwargs):
        """Custom login form.

        Args:
            *args (TYPE): Description
            **kwargs (TYPE): Description
        """
        super(CustomSignupForm, self).__init__(*args, **kwargs)
        self.fields['email'].widget.attrs.update({'autofocus': 'autofocus'})

    def custom_signup(self, request, user):
        """Custom login form.

        Args:
            request (TYPE): Description
            user (TYPE): Description
        """
        user.first_name = self.cleaned_data['first_name']
        user.last_name = self.cleaned_data['last_name']
        user.is_active = True
        user.user_type = User.USER
        user.save()
Esempio n. 13
0
    def __init__(self, *args, **kwargs):
        """ Model form initialization method """
        super(PersonUpdateForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper(self)

        self.helper.form_action = reverse('update')
        self.helper.form_method = 'POST'

        self.helper.help_text_inline = True
        self.helper.html5_required = True

        self.helper.layout = Layout(
            Div(Div(HTML("<h2 id='personal-info'>Personal Information</h2>"),
                    'first_name',
                    'last_name',
                    'birth_date',
                    'picture',
                    Div(
                        HTML('<img {%if form.instance.picture %}src="\
                        {{form.instance.picture.url}}" {% endif %}\
                        id="preview" width="200"\
                        class="img img-rounded">'), ),
                    Div(
                        HTML('<div class="row" id="loading-indicator"\
                                style="display: none">\
                              <div class="alert \
                                        alert-success" id="alert">\
                                <div class="spinner" style="display: none">\
                                  <div class="rect1"></div>\
                                  <div class="rect2"></div>\
                                  <div class="rect3"></div>\
                                  <div class="rect4"></div>\
                                  <div class="rect5"></div>\
                                </div>\
                              </div>\
                            </div>')),
                    FormActions(
                        Submit('done_button',
                               'Save',
                               css_class='btn btn-primary'),
                        Submit('cancel_button',
                               'Cancel',
                               css_class='btn btn-link'),
                    ),
                    css_class='col-xs-6'),
                Div(HTML("<h2 id='contacts'>Contacts</h2>"),
                    'contacts_email',
                    'contacts_jabber_id',
                    'contacts_skype_id',
                    'contacts_other',
                    'bio',
                    css_class='col-xs-6'),
                css_class='row'), )
Esempio n. 14
0
 def __init__(self, *args, **kwargs):
     super(CommentForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.fields['comment_text'].label = False
     self.form_method = "POST"
     self.helper.layout = Layout(
         Div(Div(PrependedText('comment_text',
                               '#',
                               placeholder='Comment Goes here //'),
                 css_class='col-md-10'),
             Div(FormActions(Submit('save', 'Comment')),
                 css_class='col-md-2'),
             css_class='row'))
Esempio n. 15
0
 def __init__(self, *args, **kwargs):
     user = kwargs.pop('user')
     super(StockItemForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper(self)
     self.helper.layout = Layout(
         Fieldset(
             'Stock Item Details',
             Div('item_name',
                 'item_code',
                 'category',
                 Submit('save', 'Save & Add'),
                 css_class="col-sm-4"),
             Div(HTML(" {% include 'stockItemsList.html' %} "),
                 css_class="col-sm-8")))
Esempio n. 16
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.fields['address'].widget = forms.Textarea()
     self.fields['address'].widget.attrs = {'rows': 3}
     self.fields['address'].required = True
     self.fields[
         'location'].help_text = "Optional. You'll be notified about new lots that can ship to this location."
     self.fields['phone_number'].help_text = "Optional"
     self.helper = FormHelper()
     self.helper.form_method = 'post'
     self.helper.form_id = 'user-form'
     self.helper.form_class = 'form'
     self.helper.form_tag = True
     self.fields['club'].widget = HiddenInput()
     if self.instance.club:
         self.fields['club_affiliation'].initial = self.instance.club.name
     self.helper.layout = Layout(
         'club',
         Div(
             Div(
                 'first_name',
                 css_class='col-md-6',
             ),
             Div(
                 'last_name',
                 css_class='col-md-6',
             ),
             css_class='row',
         ),
         Div(
             Div(
                 'phone_number',
                 css_class='col-md-4',
             ),
             Div(
                 'location',
                 css_class='col-md-3',
             ),
             Div(
                 'club_affiliation',
                 css_class='col-md-5',
             ),
             css_class='row',
         ),
         Div(
             Div('address'),
             Div('location_coordinates'),
         ),
         Submit('submit', 'Save', css_class='btn-success'),
     )
Esempio n. 17
0
 def __init__(self, *args, **kwargs):
     # Call the original __init__ method before assigning field overloads
     super(ParkInfoForm, self).__init__(*args, **kwargs)
     self.fields['name'].required = True
     self.fields['name'].label = ""
     self.fields['name'].widget.attrs['placeholder'] = u'Park Name'
     self.fields['county'].required = True
     self.fields['county'].label = ""
     self.fields['county'].widget.attrs['placeholder'] = u'County'
     self.fields['park_type'].required = True
     self.fields['park_type'].label = ""
     self.fields['park_type'].widget.attrs['placeholder'] = u'Park Type'
     self.fields['park_size'].required = True
     self.fields['park_size'].label = ""
     self.fields['park_size'].widget.attrs[
         'placeholder'] = u'Park Size in Acres'
     self.fields['url'].required = True
     self.fields['url'].label = ""
     self.fields['url'].widget.attrs['placeholder'] = u'Park Website link'
     self.helper = FormHelper()
     self.helper.help_text_inline = True
     self.helper.layout = Layout(
         Div(Div('name', css_class='span2'),
             Div('county', css_class='span2 offset4'),
             css_class='row-fluid'),
         Div(Div('park_type', css_class='span2 '),
             Div('park_size', css_class='span2 offset4'),
             css_class='row-fluid'),
         Div(Div('url', css_class='span6'), css_class='row-fluid'),
         FormActions(
             Submit('save_changes', 'Save changes',
                    css_class="btn-primary"), ))
Esempio n. 18
0
    def __init__(self, *args, **kwargs):
        """ Model form initialization method"""
        super(LogInForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper(self)
        self.helper.form_class = 'login-form active'
        self.helper.form_action = reverse('login')
        self.helper.form_method = 'POST'

        self.helper.help_text_inline = True
        self.helper.html5_required = True

        self.helper.layout = Layout(
            Div('username', 'password'),
            Div(Submit('login', 'Log in', css_class='btn btn-link')))
Esempio n. 19
0
class UpdateLanguageForm(forms.ModelForm):
    """
    Update language form
    """
    def __init__(self, *args, **kwargs):
        super(UpdateLanguageForm, self).__init__(*args, **kwargs)

    class Meta:
        model = Language
        fields = '__all__'

    helper = FormHelper()
    helper.form_method = 'POST'
    helper.form_class = 'dynamic-form'
    helper.layout = Layout(
        Div(
            Field('locale_id', css_class='form-control', readonly=True),
            Field('lang_name', css_class='form-control'),
            Field('locale_script', css_class='form-control'),
            Field('locale_alias', css_class='form-control'),
            Field('lang_status', css_class='bootstrap-switch'),
            FormActions(Submit('updateLanguage', 'Update Language'),
                        Reset('reset', 'Reset', css_class='btn-danger'))))

    def clean_locale_id(self):
        """
        Set the original value of locale_id even if POST has new value. Retrieves value from instance of Languages
        being updated. If it's None, then returns the value entered by user.
        """
        locale_id = getattr(self.instance, 'locale_id', None)
        if locale_id:
            return locale_id
        else:
            return self.cleaned_data.get('locale_id', None)
Esempio n. 20
0
 def get_form(self):
     form = super().get_form()
     form['body'].label = ''
     form['body_test'].label = ''
     form.helper = FormHelper()
     form.helper.layout = Layout(
         Row(
             Column('name', css_class='col-sm-8'),
             Column('type', css_class='col-sm-4'),
             css_class='form-row',
         ),
         TabHolder(
             Tab ('Body',
                 Field('body', css_class='mt-2 tf-nowrap'),
             ),
             Tab ('Test',
                 Field('body_test', css_class='mt-2 tf-nowrap'),
                 Div(
                     Submit('copy-from-body', 'Copy from Body'),
                     Submit('copy-to-body', 'Copy to Body'),
                     Submit('save-test', 'Save'),
                     Button('show-test', 'Show'),
                     css_class='text-right',
                 )
             ),
         ),
         FormActions(
             Submit('save', 'Save'),
             Button('delete', 'Delete'),
             Button('cancel', 'Cancel'),
         )
     )
     return form
Esempio n. 21
0
 def __init__(self, *args, **kwargs):
     super(RequisitionItemForm, self).__init__(*args, **kwargs)
     self.fields["requisition_no"].widget = HiddenInput()
     self.helper = FormHelper(self)
     self.helper.layout = Layout(
         Fieldset(
             'Requisition Items',
             Div('requisition_no',
                 'item_code',
                 'line_item',
                 'qty',
                 'unit_price',
                 'line_total',
                 css_class="col-sm-6"),
             Div(HTML(" {% include 'requisitionItems.html' %} "),
                 css_class="col-sm-6")))
Esempio n. 22
0
    def __init__(self, *args, **kwargs):
        super(SearchForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_tag = False
        self.helper.method = "GET"
        self.helper.layout = layout.Layout(
            Div(
                Div('search', css_class="col-md-3"),
                Div('min_price', css_class="col-md-3"),
                Div('max_price', css_class="col-md-3"),
                Submit('submit',
                       'Search',
                       css_class="btn-success align-self-center ml-5"),
                css_class="row",
            ))
Esempio n. 23
0
class NewPackageForm(forms.Form):
    """
    Add new package to package list
    """
    platform_choices = ()
    products_choices = ()

    package_name = forms.CharField(
        label='Package Name',
        help_text=
        'Package id as-in translation platform. Use hyphen (-) to separate words.',
        required=True,
    )
    upstream_url = forms.URLField(
        label='Upstream URL',
        help_text='Source repository location (Bitbucket, GitHub, Pagure etc).',
        required=True)
    transplatform_slug = forms.ChoiceField(
        label='Translation Platform',
        choices=platform_choices,
        help_text='Translation statistics will be fetched from this server.')
    release_streams = TextArrayField(
        label='Products',
        widget=forms.CheckboxSelectMultiple,
        choices=products_choices,
        help_text="Translation progress for selected products will be tracked."
    )

    def __init__(self, *args, **kwargs):
        self.platform_choices = kwargs.pop('platform_choices')
        self.products_choices = kwargs.pop('products_choices')
        super(NewPackageForm, self).__init__(*args, **kwargs)
        self.fields['transplatform_slug'].choices = self.platform_choices
        self.fields['release_streams'].choices = self.products_choices
        super(NewPackageForm, self).full_clean()

    helper = FormHelper()
    helper.form_method = 'POST'
    helper.form_action = '/packages/new'
    helper.form_class = 'dynamic-form'
    helper.error_text_inline = True
    helper.form_show_errors = True

    helper.layout = Layout(
        Div(
            Field('package_name',
                  css_class='form-control',
                  onkeyup="showPackageSlug()"),
            Field('upstream_url', css_class='form-control'),
            Field('transplatform_slug', css_class='selectpicker'),
            InlineCheckboxes('release_streams'), HTML("<hr/>"),
            HTML(
                "<h5 class='text-info'>Servers configured here may be contacted at intervals.</h5>"
            ),
            FormActions(Submit('addPackage', 'Add Package'),
                        Reset('reset', 'Reset', css_class='btn-danger'))))

    def is_valid(self):
        return False if len(self.errors) >= 1 else True
Esempio n. 24
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_method = 'post'
     self.helper.form_id = 'user-form'
     self.helper.form_class = 'form'
     self.helper.form_tag = True
     self.helper.layout = Layout(
         Div(
             Div(
                 'username',
                 css_class='col-md-6',
             ),
             css_class='row',
         ),
         Submit('submit', 'Save', css_class='btn-success'),
     )
Esempio n. 25
0
    def __init__(self, *args, **kwargs):
        super(TweetForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)
        self.helper.form_class = 'form-horizontal'

        self.helper.layout = Layout(
            Div(Div(AppendedText('text', "0", autofocus=True),
                    css_class="col-md-12"),
                css_class="row"),
            Div(Div(Field('publish_time'), css_class="col-md-4"),
                Div(
                    HTML(
                        """<div class="form-group"><label class="control-label">&nbsp;</label><div class="controls"><a class="btn btn-primary btn-now col-md-1" href="javascript:void(0)">Now</a></div></div>"""
                    )),
                css_class="row"),
            Submit('submit', u'Submit', css_class='btn btn-success'),
        )
Esempio n. 26
0
 def __init__(self, *args, **kwargs):
     cals = kwargs.pop('calendars')
     super(MainCalForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_tag = False
     self.helper.method = "POST"
     self.helper.form_class = 'form-inline'
     self.helper.field_template = 'bootstrap3/layout/inline_field.html'
     self.fields['calendar'] = forms.ChoiceField(choices=cals)
     self.helper.layout = Layout(
     Div(
         HTML("<label class = \"cal\"> i want my events to be scheduled on my </label>"),
         Div('calendar', css_class="col-xs-6"),
         HTML("<label class = \"cal\"> calendar.</label>"),
         css_class='row bottom',
     ),
 )
Esempio n. 27
0
    def __init__(self, *args, **kwargs):
        super(SettingCategorySelectForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper()
        # Form rendering
        self.helper.form_show_labels = False
        self.helper.layout = Layout(
            Div(
                Div(Field('category'),
                    css_class='col-sm-6',
                    style='width: 70%;'),
                Div(StrictButton(_('Select Category'), css_class='btn btn-primary', type='submit'),
                    css_class='col-sm-6',
                    style='width: 30%; padding-left: 0;'),
                css_class='row',
            ),
        )
Esempio n. 28
0
class EditProfileForm(ModelForm):
    """Edit Profile Form.

    Attributes:
        first_name (TYPE): Description
        helper (TYPE): Description
        last_name (TYPE): Description
    """

    helper = FormHelper()
    helper.method = 'POST'
    helper.form_tag = False
    helper.layout = Layout(
        Div(
            Div('first_name', css_class='col-md-6'),
            Div('last_name', css_class='col-md-6'),
            Div('email', css_class='col-md-6'),
        ),
    )

    def __init__(self, *args, **kwargs):
        """Edit profile form.

        Args:
            *args (TYPE): Description
            **kwargs (TYPE): Description
        """
        super(EditProfileForm, self).__init__(*args, **kwargs)

    class Meta:
        """Meta class for Edit Profile.

        Attributes:
            exclude (list): Description
            model (TYPE): Description
        """

        model = User
        exclude = [
            'password',
            'last_login',
            'is_superuser',
            'is_active',
            'email',
            'user_type']
Esempio n. 29
0
    def __init__(self,  *args, **kwargs):
        user = kwargs.pop('user')
        super(FuelTransferForm, self).__init__(*args, **kwargs)
        if not user.has_perm('fleet.authorize_fuelallocation'):
            self.fields["authorize"].widget = HiddenInput()  
        self.helper = FormHelper(self)
        self.helper.layout = Layout(
            Fieldset(
                'Fuel Transfer Details',
                Div(
                    'from_driver',                                         
                    'from_vehicle',                     
                    'from_fuel_card',
                    'from_balance', 
                    'from_amount_allocated', 
                    'from_new_balance',
                    'transfer_date', 
                    css_class = "col-md-6"),  
               
                Div(
                    'driver',
                    'vehicle', 
                    'to_fuel_card',
                    'to_balance', 
                    'to_amount_allocated', 
                    'to_new_balance',
                    css_class = "col-md-6"),
               
                Div(
                    'accept',
                    css_class = "col-md-2"),
               
                Div(
                    'authorize',                       
                   
                    css_class = "col-md-2"), 
                Div(
                  
                    css_class = "col-md-2"), 
            ))
        self.fields['from_driver'].widget.attrs['onchange'] = 'pop_from_vehicle_info(this)'
        self.fields['from_vehicle'].widget.attrs['onchange'] = 'pop_from_vehicle_info(this)'

        self.fields['driver'].widget.attrs['onchange'] = 'pop_vehicle_info(this)'
        self.fields['vehicle'].widget.attrs['onchange'] = 'pop_vehicle_info(this)'
Esempio n. 30
0
    def __init__(self, *args, **kwargs):
        super(TimeForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_tag = False
        self.helper.method = "POST"
        self.helper.form_class = 'form-inline'
        self.helper.field_template = 'bootstrap3/layout/inline_field.html'

        self.helper.layout = Layout(
        Div(
            HTML("<label class = \"time\"> i usually wake up at </label>"),
            Div('wake_up_time', css_class="drop_down"),
            HTML("<label class = \"time\"> and go to sleep at </label>"),
            Div('sleep_time', css_class="drop_down"),
            HTML("<label class=\"time\">.</label>"),
            css_class='row top',
        ),
    )