示例#1
0
 def __init__(self, *args, **kwargs):
     super(ReviewForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.layout = Layout(
         Field('rating'), Field('summary'),
         ButtonHolder(
             Submit('save', _("Save review"), css_class='btn-primary')))
示例#2
0
 def __init__(self, *args, **kwargs):
     super(CommentForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.layout = Layout(
         Field('content'),
         ButtonHolder(
             Submit('comment',
                    _("Send feedback"),
                    css_class='btn btn-primary')))
示例#3
0
文件: forms.py 项目: mgehling/djep
 def __init__(self, *args, **kwargs):
     super(CommentForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_class = 'form-horizontal'
     self.helper.layout = Layout(
         Fieldset(_('General'),
             Field('content'),
             ),
         ButtonHolder(Submit('comment', _("Send feedback"), css_class='btn btn-primary comment'))
         )
示例#4
0
 def __init__(self, *args, **kwargs):
     super(PurchaseForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_class = 'form-horizontal'
     self.helper.form_tag = False
     self.helper.layout = Layout(
         Fieldset(_('Billing address'), 'first_name', 'last_name',
                  'company_name', 'email', 'street', 'zip_code', 'city',
                  'country', 'vat_id', 'comments'),
         ButtonHolder(
             Submit('submit', _('Continue'), css_class='btn-primary')))
示例#5
0
文件: forms.py 项目: dhepper/djep
 def __init__(self, *args, **kwargs):
     self.current_user = kwargs.pop('current_user', None)
     super(TicketAssignmentForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_class = 'form-horizontal'
     self.helper.layout = Layout(
         'username',
         ButtonHolder(
             Submit('submit',
                    _('Assign ticket'),
                    css_class='btn btn-primary')))
示例#6
0
文件: forms.py 项目: mgehling/djep
 def __init__(self, *args, **kwargs):
     super(UpdateReviewForm, self).__init__(*args, **kwargs)
     self.helper.layout = Layout(
         Field('rating', autofocus="autofocus", tabindex=1), Field('summary', tabindex=2),
         ButtonHolder(
             HTML(u"""<a tabindex="4" class="btn" href="{0}"><i class="fa fa-fw fa-times"></i> {1}</a>""".format(
                 reverse('reviews-delete-review',
                     kwargs={'pk': kwargs.get('instance').proposal.pk}),
                 _("Delete"))),
             Submit('save', _("Save changes"), css_class='btn-primary btn save', tabindex=3)
             )
         )
示例#7
0
 def __init__(self, *args, **kwargs):
     super(UpdateTutorialProposalForm, self).__init__(*args, **kwargs)
     proposal_forms.TutorialSubmissionForm().customize_fields(form=self)
     self.helper.layout = Layout(
         Fieldset(
             _('General'),
             Field('title', autofocus='autofocus'),
             Field('description'),
             Field('abstract'),
         ), Fieldset(
             _('Details'),
             Field('audience_level'),
             Field('tags'),
         ), ButtonHolder(Submit('save', _("Save"),
                                css_class="btn-primary")))
示例#8
0
文件: forms.py 项目: dhepper/djep
 def __init__(self, *args, **kwargs):
     super(EditVenueTicketForm, self).__init__(*args, **kwargs)
     for field_name in self.instance.ticket_type.get_readonly_fields():
         field = self.fields.get(field_name)
         if not field:
             continue
         field.widget.attrs['readonly'] = 'readonly'
         field.help_text = _('This field is no longer editable.')
     self.helper = FormHelper()
     self.helper.form_class = 'form-horizontal'
     self.helper.layout = Layout(
         'first_name', 'last_name', 'organisation', 'dietary_preferences',
         'shirtsize',
         ButtonHolder(
             Submit('submit',
                    _('Save changes'),
                    css_class='btn btn-primary')))
示例#9
0
 def __init__(self, *args, **kwargs):
     super(UpdateProposalForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_class = 'form-horizontal'
     self.helper.layout = Layout(
         Fieldset(
             _('General'),
             Field('title', autofocus='autofocus'),
             Field('description'),
             Field('abstract'),
         ),
         Fieldset(
             _('Details'),
             Field('duration'),
             Field('audience_level'),
             Field('tags'),
             Field('language'),
         ), ButtonHolder(Submit('save', _("Save"),
                                css_class="btn-primary")))
示例#10
0
文件: forms.py 项目: dhepper/djep
    def __init__(self, *args, **kwargs):
        self.purchase = kwargs.pop('purchase')
        super(PurchaseOverviewForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_class = 'form-horizontal'
        self.helper.form_tag = False
        self.helper.layout = Layout(
            'accept_terms', 'payment_method',
            ButtonHolder(
                Submit('submit',
                       _('Complete purchase'),
                       css_class='btn btn-primary'),
                HTML(
                    '{% load i18n %}<a class="back" href="{% url \'attendees_purchase_names\' %}">{% trans "Back" %}</a>'
                )))
        if hasattr(settings, 'PAYMENT_METHODS') and settings.PAYMENT_METHODS:
            choices = self.fields['payment_method'].choices
            new_choices = []
            for choice in choices:
                if choice[0] in settings.PAYMENT_METHODS:
                    new_choices.append(choice)
            self.fields['payment_method'].choices = new_choices

        # Filter payment methods if they are not allowed based on the
        # min. amount threshold
        total_amount = self.purchase.payment_total
        new_choices = []
        supported_methods = []
        for choice in self.fields['payment_method'].choices:
            minimum = settings.MIN_TOTAL_FOR_PAYMENT_METHOD.get(choice[0])
            if minimum is None or minimum < total_amount:
                new_choices.append(choice)
                supported_methods.append(choice[0])
        self.fields['payment_method'].choices = new_choices
        self.fields['payment_method'].help_text = self.\
            _get_payment_method_helptext(supported_methods)

        if len(new_choices) == 1:
            self.fields['payment_method'].initial = new_choices[0][0]
            if settings.HIDE_SINGLE_PAYMENT_METHOD:
                self.fields['payment_method'].widget = forms.HiddenInput()
示例#11
0
 def __init__(self, *args, **kwargs):
     super(PurchaseOverviewForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_class = 'form-horizontal'
     self.helper.form_tag = False
     self.helper.layout = Layout(
         'accept_terms', 'payment_method',
         ButtonHolder(
             Submit('submit',
                    _('Complete purchase'),
                    css_class='btn-primary'),
             HTML(
                 '{% load i18n %}<a class="back" href="{% url \'attendees_purchase_names\' %}">{% trans "Back" %}</a>'
             )))
     if hasattr(settings, 'PAYMENT_METHODS') and settings.PAYMENT_METHODS:
         choices = self.fields['payment_method'].choices
         new_choices = []
         for choice in choices:
             if choice[0] in settings.PAYMENT_METHODS:
                 new_choices.append(choice)
         self.fields['payment_method'].choices = new_choices