class SelectEventForm(Form):
    required_css_class = 'required'
    error_css_class = 'error'
    day = MultipleChoiceField(
        widget=CheckboxSelectMultiple(attrs={'class': 'form-check-input'}),
        required=False)
    calendar_type = MultipleChoiceField(
        choices=list(calendar_type_options.items()),
        widget=CheckboxSelectMultiple(attrs={'class': 'form-check-input'}),
        required=False)
    staff_area = ModelMultipleChoiceField(
        queryset=StaffArea.objects.all().order_by("conference", "slug"),
        widget=CheckboxSelectMultiple(attrs={'class': 'form-check-input'}),
        required=False)
Esempio n. 2
0
class tryForm(forms.Form):
    def __init__(self, *args, **kwargs):
        super(tryForm, self).__init__(*args, **kwargs)
        for key in self.fields:
            self.fields[key].required = False

    choice_batch = (('台北', '台北'), ('台中', '台中'), ('高雄', '高雄'))
    batch = forms.ChoiceField(label='場次', choices=choice_batch)
    companyName = forms.CharField(label='公司名稱')
    contactPerson = forms.CharField(label='聯絡人')
    phone = forms.CharField(label='電話')
    email = forms.EmailField(label='電子信箱')
    choice_export = (
        ('None', 'None'),
        ('yes', 'yes'),
        ('no', 'no'),
    )
    isExport = forms.ChoiceField(label='是否為出口商', choices=choice_export)
    choice_planToExhibit = (('None', 'None'), ('yes', 'yes'), ('no', 'no'))
    planToExhibit = forms.ChoiceField(label='出國參展之計畫',
                                      choices=choice_planToExhibit)
    planToExhibit_year = forms.CharField(label='預計__年內')
    planToExhibit_where = forms.CharField(label='想去__')
    productToExport = forms.CharField(label='目標出口產品')
    HScode = forms.CharField(label='海關稅則編碼(HS code)')
    marketToExport = forms.CharField(label='目標拓銷市場')
    choice_reasonToExhibit = (('該展的前瞻性', '該展的前瞻性'), ('去該展要花多少錢', '去該展要花多少錢'),
                              ('展覽日期', '展覽日期'), ('該展有沒有補助', '該展有沒有補助'),
                              ('該展產業是否與公司本次拓銷產品相符', '該展產業是否與公司本次拓銷產品相符'),
                              ('競爭對手或對手國參加與否', '競爭對手或對手國參加與否'), ('其他', '其他'))
    firstReason = forms.MultipleChoiceField(label='影響去哪國參展的最重要因素',
                                            widget=CheckboxSelectMultiple(),
                                            choices=choice_reasonToExhibit)
    firstReasonOther = forms.CharField(label='請說明')
    secondReason = forms.MultipleChoiceField(label='影響去哪國參展的最次要因素',
                                             widget=CheckboxSelectMultiple(),
                                             choices=choice_reasonToExhibit)
    secondReasonOther = forms.CharField(label='請說明')
    choice_helpYou = (('None', 'None'), ('yes', 'yes'), ('no', 'no'))
    isHelpYou = forms.ChoiceField(label='本平台資訊有幫助?', choices=choice_helpYou)
    isHelpYou_reason = forms.CharField(label='原因')
    choice_rec = (('None', 'None'), ('yes', 'yes'), ('no', 'no'))
    recToOther = forms.ChoiceField(label='願意推薦平台給其他廠商?', choices=choice_rec)
    choice_recieve = (('None', 'None'), ('yes', 'yes'), ('no', 'no'))
    recieveInfo = forms.ChoiceField(label='願意收到平台相關資訊?',
                                    choices=choice_recieve)
    choice_helpUs = (('None', 'None'), ('yes', 'yes'), ('no', 'no'))
    helpUs = forms.ChoiceField(label='願意協助平台優化?', choices=choice_helpUs)
Esempio n. 3
0
class SelectEventForm(Form):
    required_css_class = 'required'
    error_css_class = 'error'
    day = MultipleChoiceField(widget=CheckboxSelectMultiple(), required=False)
    calendar_type = MultipleChoiceField(choices=calendar_type_options.items(),
                                        widget=CheckboxSelectMultiple(),
                                        required=False)
    staff_area = ModelMultipleChoiceField(
        queryset=StaffArea.objects.all().order_by("conference", "slug"),
        widget=CheckboxSelectMultiple(),
        required=False)
    volunteer_type = ModelMultipleChoiceField(
        queryset=AvailableInterest.objects.filter(
            visible=True).order_by("interest"),
        widget=CheckboxSelectMultiple(),
        required=False)
Esempio n. 4
0
 def __init__(self, *args, **kwargs):
     super(forms.ModelForm, self).__init__(*args, **kwargs)
     self.fields["alignment_algorithms"].widget = CheckboxSelectMultiple() 
     self.fields["alignment_algorithms"].queryset = AlignmentAlgorithm.objects.all()
     self.fields["alignment_algorithms"].initial = AlignmentAlgorithm.objects.all()
     self.fields['alignment_algorithms'].label = "Use the following alignment algorithms"
     self.fields['alignment_algorithms'].help_text = ""
     
     self.fields["raxml_models"].widget = CheckboxSelectMultiple() 
     self.fields["raxml_models"].queryset = RaxmlModel.objects.all()
     self.fields['raxml_models'].initial = RaxmlModel.objects.all()
     self.fields['raxml_models'].help_text = ""
     self.fields['raxml_models'].label = "Try the following RAxML models"
     
     self.fields['name'].label = "Name this job"
     self.fields['project_description'].label = "Project description (optional)"
Esempio n. 5
0
class LinkBPTEventForm(forms.ModelForm):
    '''
    Used in event creation in gbe to set up ticket info when making a new class
    '''
    required_css_class = 'required'
    error_css_class = 'error'
    ticketing_events = PickBPTEventField(
        queryset=TicketingEvents.objects.exclude(
            conference__status="completed").order_by('event_id'),
        required=False,
        label=link_event_labels['ticketing_events'],
        widget=CheckboxSelectMultiple(),
    )
    event_id = forms.IntegerField(required=False,
                                  label=link_event_labels['event_id'])
    display_icon = forms.CharField(
        required=False,
        label=link_event_labels['display_icon'],
        help_text=link_event_help_text['display_icon'])

    class Meta:
        model = TicketingEvents
        fields = ['event_id', 'display_icon']
        labels = link_event_labels
        help_texts = link_event_help_text

    def __init__(self, *args, **kwargs):
        super(LinkBPTEventForm, self).__init__(*args, **kwargs)
        if 'initial' in kwargs and 'conference' in kwargs['initial']:
            initial = kwargs.pop('initial')
            self.fields[
                'ticketing_events'].queryset = TicketingEvents.objects.filter(
                    conference=initial['conference']).order_by('event_id')
Esempio n. 6
0
class TagsFilter(forms.Form):
    """
    Tags Form
    """
    tags = forms.ModelMultipleChoiceField(queryset=Tag.objects.all(),
                                          widget=CheckboxSelectMultiple(),
                                          to_field_name='slug')
Esempio n. 7
0
 def __init__(self, *args, **kwargs):
     super(EditProfileForm, self).__init__(*args, **kwargs)
     self.fields["tags"].widget = CheckboxSelectMultiple()
     self.fields["tags"].queryset = ProfileTag.objects.all()
     for field_name, field in self.fields.items():
         if field_name != "tags":
             field.widget.attrs['class'] = 'form-control form-control-sm'
    class Meta:
        model = TBR
        fields = ['title', 'book']

        widgets = {
            "book": CheckboxSelectMultiple(),
        }
Esempio n. 9
0
	def __init__(self, *args, **kwargs):
		super().__init__(*args, **kwargs)
		self.fields['genre'].widget = CheckboxSelectMultiple()
		self.fields['genre'].queryset = Genre.objects.all()
		self.helper = FormHelper()
		self.helper.form_method = 'post'
		self.helper.add_input(Submit('submit', 'submit'))
Esempio n. 10
0
 class SelectOntologyForm(forms.Form):
     """ A simple form to select classification ontologies. A choice
     field allows to select a single class that 'is_a' 'classification_root'.
     """
     ontologies = forms.ModelMultipleChoiceField(
         queryset=Class.objects.filter(id__in=class_ids),
         widget=CheckboxSelectMultiple(attrs={'class': 'autoselectable'}))
Esempio n. 11
0
    def get_form_field_instances(self,
                                 request=None,
                                 form_entry=None,
                                 form_element_entries=None,
                                 **kwargs):
        """Get form field instances."""
        choices = self.get_choices()

        field_kwargs = {
            'label':
            self.data.label,
            'help_text':
            self.data.help_text,
            'initial':
            self.data.initial,
            'required':
            self.data.required,
            'choices':
            choices,
            'widget':
            CheckboxSelectMultiple(
                attrs={'class': theme.form_element_html_class}),
        }

        return [(self.data.name, MultipleChoiceField, field_kwargs)]
Esempio n. 12
0
 class Meta:
     model = Job
     fields = (
         'job_title',
         'company_name',
         'category',
         'job_types',
         'other_job_type',
         'city',
         'region',
         'country',
         'description',
         'requirements',
         'company_description',
         'contact',
         'email',
         'url',
         'telecommuting',
         'agencies',
     )
     widgets = {
         'job_types': CheckboxSelectMultiple(),
     }
     help_texts = {
         'email': (
             "<b>This email address will be publicly displayed for "
             "applicants to contact if they are interested in the "
             "posting.</b>"
         ),
     }
Esempio n. 13
0
class SimpleSearch(forms.Form):
    
    CHOICES=(('shipping_address', 'Shipping address'),
             ('billing_address', 'Billing address'), ('customer', 'Customer'))
    
    search_query = forms.CharField(max_length=64, label="Search for", required=True)
    search_by = forms.MultipleChoiceField(label="Using", choices=CHOICES, widget=CheckboxSelectMultiple(), required=False)
Esempio n. 14
0
class Player(BasePlayer):
    love_this = models.StringField(
        label="Easily choose multiple answers!",
        widget=CheckboxSelectMultiple(
            choices=(
                # or use (number, string) pair
                # if you want better data analysis
                # (1, "This is awesome!"),
                ("This is awesome!", "This is awesome!"),
                ("Great!", "Great!"),
                ("I love this!", "I love this!"),
                ("Don't like it (really?💣)", "Don't like it (really?💣)"),
            )
        ),
    )

    def love_this_error_message(self, val):
        temp = val
        for ans in Constants.love_this_answer:
            temp = temp.replace(ans, "")

        # After removing all correct answers from val,
        # we should expect there to be no word character in the result
        # If we still find any word character, then this must be
        # coming from wrong answers.
        pattern = re.compile("\w")
        if pattern.search(temp):
            return "Correct answers: {}".format(Constants.love_this_answer)
Esempio n. 15
0
class ApplicationFilterForm(forms.Form):
    types = forms.MultipleChoiceField(
        choices=PaperApplication.TYPES,
        widget=CheckboxSelectMultiple(),
        required=False,
        label="",
    )
Esempio n. 16
0
 def __init__(self, *args, **kwargs):
     super(EntityForm, self).__init__(*args, **kwargs)
     editor_users_choices = self.fields['editor_users'].widget.choices
     self.fields['editor_users'].widget = CheckboxSelectMultiple(
         choices=editor_users_choices)
     self.fields['editor_users'].help_text = _("These users can edit only "
                                               "this entity")
Esempio n. 17
0
    def __init__(self, *args, **kwargs):
        from django.forms.widgets import CheckboxSelectMultiple

        super(Event_ParticipationForm, self).__init__(*args, **kwargs)

        self.fields["event_participants"].widget = CheckboxSelectMultiple()
        self.fields["event_participants"].queryset = User.objects.all()
Esempio n. 18
0
 class Meta:
     model = Member
     fields = (
         'avatar',
         'first_name',
         'last_name',
         'gender',
         'date_of_birth',
         'place_of_birth',
         'nationality',
         'fiscal_code',
         'email',
         'no_spam',
         'address',
         'phone',
         'email_2',
         'course',
         'course_alt',
         'course_membership',
         'sign_up',
         'privacy',
         'med_cert',
     )
     widgets = {
         'avatar': SmallClearableFileInput(),
         'sign_up': SmallClearableFileInput(),
         'privacy': SmallClearableFileInput(),
         'med_cert': SmallClearableFileInput(),
         'course': CheckboxSelectMultiple(),
     }
Esempio n. 19
0
 def __init__(self, user, *args, **kwargs):
     super(ProductorForm, self).__init__(*args, **kwargs)
     self.fields["responsable"].widget = CheckboxSelectMultiple()
     g = Group.objects.get(name='Productors')
     self.fields["responsable"].queryset = g.user_set.all()
     self.fields[
         "hores_limit"].label = 'Temps límit per a fer comandes en Hores'
    def __init__(self, attrs=None):
        freqChoices = [(3, "Daily"),
                       (2, "Weekly"),
                       (1, "Monthly"),
                       (0, "Yearly")]
        ordChoices  = [(1, "The First"),
                       (2, "The Second"),
                       (3, "The Third"),
                       (4, "The Fourth"),
                       (5, "The Fifth"),
                       (-1, "The Last"),
                       (_EveryDay, "Every"),
                       (_SameDay, "The Same")]
        dayChoices1  = enumerate(calendar.day_abbr)
        dayChoices2  = list(enumerate(calendar.day_name)) +\
                       [(_DayOfMonth, "Day of the month")]
        monthChoices = enumerate(calendar.month_name[1:], 1)

        numAttrs = {'min': 1, 'max': 366}
        if attrs:
            numAttrs.update(attrs)
        widgets = [AdminDateInput(attrs=attrs),
                   Select(attrs=attrs, choices=freqChoices), #1
                   NumberInput(attrs=numAttrs),
                   CheckboxSelectMultiple(attrs=attrs, choices=dayChoices1),
                   NumberInput(attrs=numAttrs),
                   AdminDateInput(attrs=attrs),              #5
                   Select(attrs=attrs, choices=ordChoices),
                   Select(attrs=attrs, choices=dayChoices2),
                   Select(attrs=attrs, choices=monthChoices) ]
        super().__init__(widgets, attrs)
Esempio n. 21
0
 def __init__(self, user, *args, **kwargs):
     super(NodeForm, self).__init__(*args, **kwargs)
     self.fields["responsable"].widget = CheckboxSelectMultiple()
     g = Group.objects.get(name='Nodes')
     self.fields["responsable"].queryset = g.user_set.all()
     self.fields["frequencia"].queryset = Frequencia.objects.all()
     self.fields["position"].label = 'Coordenades'
Esempio n. 22
0
 def __init__(self, user, *args, **kwargs):
     super(ProductorForm, self).__init__(*args, **kwargs)
     self.fields["responsable"].widget = CheckboxSelectMultiple()
     g = Group.objects.get(name='Productors')
     self.fields["responsable"].queryset = g.user_set.all()
     self.fields[
         "hores_limit"].label = 'Hores de diferència per defecte entre entrega i el tancament de les comandes'
Esempio n. 23
0
class StudyHostProfileForm(forms.ModelForm):
    title = "Detalles del anfitrión de estudios"
    widgets = {
            'institute_character':forms.RadioSelect,
    }

    high_quality_accreditations = forms.MultipleChoiceField(
        required=False,
        label='Acreditaciones de alta calidad',
        widget=CheckboxSelectMultiple(),
        choices=StudyHostProfile.ACCREDITATIONS_CHOICES,
    )

    #knowledge_topics = forms.CharField(label='Áreas de conocimiento',
    #                            widget=forms.TextInput(attrs={
    #                                'placeholder': 'Una lista de temas separada por comas'}))




    class Meta:
        model = StudyHostProfile
        fields = ('institution_type', 'institute_character',
            'high_quality_accreditations', 'students_number',
            'rankings_classification', 'knowledge_topics', )
Esempio n. 24
0
class QuizSessionCreateForm(ModelForm):
    class Meta:
        model = QuizSession
        fields = []

    max_num_questions = forms.ChoiceField(
        label="Maximum number of questions",
        choices=((10, "10"), (50, "50"), (100, "100")),
        widget=forms.RadioSelect,
        initial=10,
        required=False,
    )

    categories = forms.ModelMultipleChoiceField(
        queryset=Category.objects.all(),
        required=False,
        label="Include questions from categories",
        widget=CheckboxSelectMultiple(attrs={"checked": ""}),  # All selected by default
    )

    include_answered = forms.BooleanField(
        label="Include already answered questions?",
        required=False,
        initial=False,
    )
    randomise_order = forms.BooleanField(
        label="Randomise the order of the questions?",
        required=False,
        initial=True,
    )
Esempio n. 25
0
 def __init__(self, *args, **kwargs):
     
     super(ProblemForm, self).__init__(*args, **kwargs)
     
     self.fields["people_in_charge"].widget = CheckboxSelectMultiple()
     self.fields["people_in_charge"].widget.attrs['class'] = 'list-style'
     self.fields["people_in_charge"].queryset = User.objects.filter(groups__name='RedeCasd')
Esempio n. 26
0
 class Meta:
     fields = [
         'name',
         'status',
         'photo',
         'short_description',
         'information_for_getpet_team',
         'description',
         'gender',
         'age',
         'weight',
         'desexed',
         'properties',
         'special_information',
     ]
     widgets = {
         'photo': FileInput(attrs={
             'data-show-remove': 'false',
         }),
         'information_for_getpet_team': Textarea(attrs={'rows': 2}),
         'description': Textarea(attrs={'rows': 6}),
         'special_information': Textarea(attrs={'rows': 2}),
         'short_description':
         TextInput(attrs={'data-provide': "maxlength"}),
         'properties': CheckboxSelectMultiple(),
         'gender': RadioSelect(),
         'desexed': RadioSelect(),
     }
     labels = {
         'photo': "",
         'information_for_getpet_team': "",
         'properties': "",
     }
Esempio n. 27
0
class ApplicationForm2(forms.Form):
    # Allow blank choices
    GENDERS = (('', '----'), ) + Application.GENDERS
    RACES = (('', '----'), ) + Application.RACES
    REFERRED_OPTIONS = (('', '----'), ) + Application.REFERRED_OPTIONS

    gender = forms.ChoiceField(widget=Select(attrs={'id': 'id_gender'}),
                               choices=GENDERS)

    race = forms.ChoiceField(widget=Select(attrs={'id': 'id_race'}),
                             choices=RACES)

    race_other = forms.CharField(widget=Input(attrs={'id': 'id_race_other'}),
                                 max_length=120,
                                 required=False)

    referred = forms.ChoiceField(widget=Select(attrs={'id': 'id_referred'}),
                                 choices=REFERRED_OPTIONS)

    referred_other = forms.CharField(
        widget=Input(attrs={'id': 'id_referred_other'}),
        max_length=120,
        required=False)

    veteran = forms.BooleanField(
        widget=CheckboxInput(attrs={'id': 'id_veteran'}), required=False)

    military_service = forms.MultipleChoiceField(
        widget=CheckboxSelectMultiple(attrs={'id': 'id_military_service'}),
        choices=Application.MILITARY_OPTIONS,
        required=False)
def field_to_widget(field):
    if type(field) is CharField:
        if field.choices:
            return Select(attrs={"class": "form-control"})
        return TextInput(attrs={"class": "form-control", "rows": 1})
    if type(field) is TextField:
        return Textarea(attrs={"class": "form-control", "rows": 1})
    if type(field) is AutoField:
        return HiddenInput(attrs={"class": "form-control", "rows": 1})
    if type(field) is IntegerField or type(field) is FloatField:
        return NumberInput(attrs={"class": "form-control"})
    if type(field) is EmailField:
        return EmailInput(attrs={"class": "form-control"})
    if type(field) is ForeignKey:
        return Select(attrs={"class": "form-control"})
    if type(field) is ManyToManyField:
        return CheckboxSelectMultiple(attrs={"class": ""})
    if type(field) is BooleanField:
        return CheckboxInput(attrs={"class": "form-control"})
    if type(field) is FileField:
        return FileInput(attrs={"class": "form-control"})
    if type(field) is DateField:
        return DateInput(attrs={"class": "form-control date", "type": "date"})
    if type(field) is DateTimeField:
        return DateTimeInput(attrs={"class": "form-control datetimepicker"})

    return TextInput(attrs={"class": "form-control", "rows": 1})
Esempio n. 29
0
 def __init__(self, *args, **kwargs):
    super(TrainingModelForm, self).__init__(*args, **kwargs)
    for name in self.fields.keys():
         self.fields[name].widget.attrs.update({
             'class': 'form-control',
         })
    self.fields['training_name'].label = "Training Name"
    self.fields['training_name'].widget.attrs['placeholder'] = "Enter Training Name"
    self.fields['training_description'].label = "Training Description"
    self.fields['training_description'].widget.attrs['placeholder'] = "Enter Training Description"
    self.fields['category'].label_from_instance = lambda obj: "{}".format(obj.category_name)
    self.fields['category'].widget.attrs['readonly'] = 'readonly'
    self.fields['category'].label = "Training Category"
    self.fields['vendor'].label_from_instance = lambda obj: "{}".format(obj.vendor_name)
    self.fields['vendor'].widget.attrs['readonly'] = 'readonly'
    self.fields['vendor'].label = "Vendor"
    self.fields['staff_name'].label_from_instance = lambda obj: "%s %s" % (obj.first_name, obj.last_name)
    self.fields['staff_name'].label = "Staff Name"
    self.fields['staff_name'].widget = CheckboxSelectMultiple()
    self.fields['staff_name'].queryset = User.objects.all()
    self.fields['projected_start_date'].label = "Training Projected Start Date"
    self.fields['projected_start_date'].widget.attrs['placeholder'] = "Enter Training Projected Start Date"
    self.fields['projected_end_date'].label = "Training Projected End Date"
    self.fields['projected_end_date'].widget.attrs['placeholder'] = "Enter Training Projected End Date"
    self.fields['training_venue'].label = "Training Venue"
    self.fields['training_venue'].widget.attrs['placeholder'] = "Enter Training Venue"
    self.fields['training_budget'].label = "Training Budget"
    self.fields['training_budget'].widget.attrs['placeholder'] = "Enter Training Budget"
Esempio n. 30
0
class DocumentForm(forms.ModelForm):
    """
    Форма загрузки документа
    В дальнейшем вероятно удалить
    """
    doc_image_content = forms.FileField(required=False)
    doc_pdf_content = forms.FileField(required=False)
    related_documents = forms.ModelMultipleChoiceField(
                            queryset=Documents.objects.all(),
                            widget=CheckboxSelectMultiple(),
                            required=False,
                        )

    class Meta:
        model = Documents
        fields = ('doc_kind',
                  'doc_mark',
                  'doc_name_ru',
                  'doc_name_en',
                  'doc_annotation',
                  'doc_comment',
                  'doc_sys_number',
                  'doc_full_mark',
                  'doc_status',
                  'application_status',
                  'doc_reg_date',
                  'doc_limit_date',
                  'doc_on_rf_use',
                  'classifier_pns',
                  'doc_assign_org',
                  'doc_assign_date',
                  'classifier_enterd_countries',
                  'doc_reg_text',
                  'doc_effective_date',
                  'doc_restoration_date',
                  'doc_enter_org',
                  'classifier_okved',
                  'classifier_oks',
                  'classifier_okp',
                  'tk_rus',
                  'org_author_name',
                  'mtk_dev',
                  'keywords',
                  'doc_annotation_ru',
                  'doc_origin_language',
                  'contains_in_npa_links',
                  'cancel_in_part',
                  'doc_o_zsh',
                  'doc_o_zgo_vch',
                  'doc_o_zgo',
                  'doc_o_zsh_vch',
                  'doc_supplemented',
                  'doc_supplementing',
                  'doc_outside_system',
                  'doc_html_content',

                  'doc_changes',
                  'has_document_case',
                 )