class Meta: model = orderModel fields = ('number', 'haveKit', 'kitId', 'username', 'email', 'phone', 'province', 'city', 'county', 'address', 'paymentMethod', 'radioInvoice', 'invoice', 'message') widgets = { 'number': NumberInput(attrs={'min': 1}), 'haveKit': RadioSelect(), 'paymentMethod': RadioSelect(), 'radioInvoice': RadioSelect(), } def clean_kitId(self): #allow empty for kitId return self.cleaned_data['kitId'] or None help_texts = { 'username': '******', } error_messages = { 'username': { 'required': u'请输入联系人姓名', 'invalid': u'请输入正确的联系人姓名' }, 'email': { 'required': u'需要输入邮箱', 'invalid': u'请提供有效的邮箱地址' }, }
class Meta: model = ClusterRecsReviewQA fields = ["usefulness_qa", "choice_qa"] widgets = { 'usefulness_qa': RadioSelect(), 'choice_qa': RadioSelect(), }
def __init__(self, *args, **kwargs): super(PendingUserForm, self).__init__(*args, **kwargs) self.empty_permitted = False if "language" in self.fields: self.fields["language"].widget = RadioSelect( choices=PendingUser.LANGUAGE_CHOICES) if "membership_type" in self.fields: self.fields["membership_type"].widget = RadioSelect( choices=PendingUser.MEMBERSHIP_TYPE_CHOICES) if "is_ayy_member" in self.fields: self.fields["is_ayy_member"].widget = RadioSelect( choices=PendingUser.AYY_MEMBER_CHOICES) if "start_year" in self.fields: self.fields["start_year"] = TypedChoiceField( label=_(self.fields["start_year"].label), coerce=int, choices=year_choices, initial=timezone.now().year, ) for visible in self.visible_fields(): if visible.name not in [ "language", "membership_type", "is_ayy_member", "has_accepted_policies", ]: visible.field.widget.attrs["class"] = "form-control"
class SocialHistoryDataForm(ModelForm): smoker = TypedChoiceField(required=False, empty_value=None, choices=((True, _("Yes")), (False, _("No"))), widget=RadioSelect(attrs={'id': 'id_smoker'})) ex_smoker = TypedChoiceField(required=False, empty_value=None, choices=((True, _("Yes")), (False, _("No"))), widget=RadioSelect) alcoholic = TypedChoiceField( required=False, empty_value=None, choices=((True, _("Yes")), (False, _("No"))), widget=RadioSelect(attrs={'id': 'id_alcoholic'})) class Meta: model = SocialHistoryData fields = [ 'smoker', 'amount_cigarettes', 'ex_smoker', 'alcoholic', 'alcohol_frequency', 'alcohol_period', 'drugs', ] widgets = dict( amount_cigarettes=Select(attrs={'class': 'form-control'}), alcohol_frequency=Select(attrs={'class': 'form-control'}), alcohol_period=Select(attrs={'class': 'form-control'}), drugs=RadioSelect(choices=(('ja_fez', _("Have already used")), ('faz', _('It is using')), ('nunca_fez', _('Have never used')))))
class ExportForm(Form): title = CharField(required=False, widget=TextInput(attrs={ 'class': 'form-control', 'disabled': '' })) per_participant = BooleanField(initial=True, required=False) per_questionnaire = BooleanField(initial=True, required=False) per_eeg_raw_data = BooleanField(initial=True, required=False) per_eeg_nwb_data = BooleanField(initial=True, required=False) per_emg_data = BooleanField(initial=True, required=False) per_tms_data = BooleanField(initial=True, required=False) per_additional_data = BooleanField(initial=True, required=False) per_goalkeeper_game_data = BooleanField(initial=True, required=False) per_stimulus_data = BooleanField(initial=True, required=False) per_generic_data = BooleanField(initial=True, required=False) questionnaire_entrance_selected = [] headings = ChoiceField(widget=RadioSelect(), choices=HEADINGS_CHOICES, required=False) responses = MultipleChoiceField(widget=CheckboxSelectMultiple( attrs={'data-error': _('Response must be selected')}), choices=RESPONSES_CHOICES, required=False) filesformat = ChoiceField(widget=RadioSelect(), choices=FORMATS_CHOICES, required=False)
class MySQLNullBooleanForm(Form): nullbool0 = NullBooleanField(widget=RadioSelect( choices=NULLBOOL_CHOICES)) nullbool1 = NullBooleanField(widget=RadioSelect( choices=NULLBOOL_CHOICES)) nullbool2 = NullBooleanField(widget=RadioSelect( choices=NULLBOOL_CHOICES))
class Meta: model = Tool fields = [ 'name', 'niches', 'description', 'url', 'pricing', 'license_type', 'license', 'sectors', 'languages_supported', 'coop_made' ] labels = { 'name': _('Name of tool'), 'niches': _('What is this tool used for?'), 'description': _('Description of tool'), 'url': _('URL of tool website'), 'license_type': _('How is this tool licensed?'), 'sectors': _('Please choose a sector or sectors:'), 'languages_supported': _('What languages does this tool support?'), 'coop_made': _('Was this tool created by a co-op?') } help_texts = { 'description': _('Max 270 characters.'), 'sectors': _('Hold down the <kbd>ctrl</kbd> (Windows) or <kbd>command</kbd> (macOS) key to select multiple options.'), 'languages_supported': _('Hold down the <kbd>ctrl</kbd> (Windows) or <kbd>command</kbd> (macOS) key to select multiple options.') } widgets = { 'license_type': RadioSelect(attrs={'class': 'input-group radio', 'id': 'id_detailed_info-license_type'}), 'license': Select(attrs={'id': 'id_detailed_info-license'}), 'coop_made': RadioSelect(attrs={'class': 'input-group radio'}) }
class Meta: model = InstitutionProfile # #todo -- convert this to a templated form with hand-controlled HTML # #fyi -- "twitter_image_displayed" is not shown (SPARC can change the value through the back-end) # why are we listing fields explicitly? because there are many #opendata fields which we don't want to display fields = list(''' institution_website institution_twitter poc_name poc_job poc_email poc_twitter poc_url poc_visibility overview_raw campus_engagement library_engagement subject_engagement url_oer url_libguide taskforce staff staff_location catalog oer_included oerdegree_offered private_comments filled_in_by acknowledgments '''.split()) widgets = { 'poc_visibility': RadioSelect(choices=InstitutionProfile.POC_VISIBILITY_CHOICES), 'campus_engagement': CheckboxSelectMultiple( choices=InstitutionProfile.CAMPUS_ENGAGEMENT_CHOICES), 'library_engagement': CheckboxSelectMultiple( choices=InstitutionProfile.LIBRARY_ENGAGEMENT_CHOICES), 'subject_engagement': CheckboxSelectMultiple( choices=InstitutionProfile.SUBJECT_ENGAGEMENT_CHOICES), 'taskforce': RadioSelect(choices=InstitutionProfile.TASKFORCE_CHOICES), 'staff': RadioSelect(choices=InstitutionProfile.STAFF_CHOICES), 'staff_location': CheckboxSelectMultiple( choices=InstitutionProfile.STAFF_LOCATION_CHOICES), 'catalog': CheckboxSelectMultiple(choices=InstitutionProfile.CATALOG_CHOICES), 'oer_included': CheckboxSelectMultiple( choices=InstitutionProfile.OER_INCLUDED_CHOICES), 'oerdegree_offered': RadioSelect(choices=InstitutionProfile.OERDEGREE_OFFERED_CHOICES), }
class Meta: model = Event exclude = ['reviewed', 'hidden', 'institution'] widgets = { # #todo -- 'type': Question Type: Radio button with fill-in other 'type': RadioSelect(choices=Event.TYPE_CHOICES), 'scope': RadioSelect(choices=Event.SCOPE_CHOICES), }
class Meta: model = Event fields = ('tournament', 'category', 'title', 'start_at', 'division', 'format', 'draw', 'game') widgets = {'tournament': HiddenInput(), 'category': RadioSelect(renderer=HorizontalRadioRenderer), 'format': RadioSelect(renderer=HorizontalRadioRenderer), 'draw': RadioSelect(renderer=HorizontalRadioRenderer), 'game': RadioSelect(renderer=HorizontalRadioRenderer), }
class Meta: model = UserProfile fields = ('smoker', 'talker', 'music') widgets = { 'smoker': RadioSelect(), 'talker': RadioSelect(), 'music': RadioSelect(), }
class Meta: model = Order fields = '__all__' widgets = { 'category': RadioSelect(), 'subcategory': RadioSelect(), }
class Meta: model = Interruption fields = ['cause_1', 'cause_2', 'cause_3'] widgets = { 'cause_1': RadioSelect(), 'cause_2': RadioSelect(), 'cause_3': RadioSelect(), }
class Meta: model = UserRegistrationCourse exclude = ('user', 'course_id', 'language_code') widgets = { 'origin': RadioSelect(attrs={'required': 'required'}), 'homeless': RadioSelect(attrs={'required': 'required'}), 'disabled_person': RadioSelect(attrs={'required': 'required'}), 'social_disadvantage': RadioSelect(attrs={'required': 'required'}) }
class Meta: model = RecsReviewQA fields = ["quality_qa", "diversity_qa", "easiness_qa", "happiness_qa"] widgets = { 'quality_qa': RadioSelect(), 'diversity_qa': RadioSelect(), 'easiness_qa': RadioSelect(), 'happiness_qa': RadioSelect(), }
class Meta: model = RecordCategory fields = ('prop', 'record_type', ) widgets = {'prop': RadioSelect( attrs={'onclick': 'this.form.submit()', 'onChange': 'this.form.submit();', "class":"rb w-radio-input"}), 'record_type': RadioSelect(attrs={ 'onChange': 'this.form.submit();', "class":"rb w-radio-input"})}
class Meta: model = Annotation fields = '__all__' widgets = { 'user': HiddenInput(), 'query': HiddenInput(), 'is_geo': RadioSelect(), 'loc_type': RadioSelect(), 'query_type': RadioSelect(), }
class Meta: model = SocialDemographicData fields = ['natural_of', 'citizenship', 'profession', 'occupation', 'tv', 'dvd', 'radio', 'bath', 'automobile', 'wash_machine', 'refrigerator', 'freezer', 'house_maid', 'religion', 'payment', 'flesh_tone', 'patient_schooling', 'schooling', 'benefit_government', 'social_class'] widgets = { 'natural_of': TextInput(attrs={'class': 'form-control'}), 'citizenship': SelectBoxCountries(attrs={'data-flags': 'true'}), 'patient_schooling': Select(attrs={'class': 'form-control'}), 'schooling': Select(attrs={'class': 'form-control'}), 'flesh_tone': Select(attrs={'class': 'form-control'}), 'religion': Select(attrs={'class': 'form-control'}), 'profession': TextInput(attrs={'class': 'form-control', 'placeholder': _('Type in profession')}), 'occupation': TextInput(attrs={'class': 'form-control', 'placeholder': _('Inform occupation')}), 'payment': Select(attrs={'class': 'form-control'}), 'tv': RadioSelect(choices=((0, '0'), (1, '1'), (2, '2'), (3, '3'), (4, _('4 or +')))), 'dvd': RadioSelect(choices=((0, '0'), (1, '1'), (2, '2'), (3, '3'), (4, _('4 or +')))), 'radio': RadioSelect(choices=((0, '0'), (1, '1'), (2, '2'), (3, '3'), (4, _('4 or +')))), 'bath': RadioSelect(choices=((0, '0'), (1, '1'), (2, '2'), (3, '3'), (4, _('4 or +')))), 'automobile': RadioSelect(choices=((0, '0'), (1, '1'), (2, '2'), (3, '3'), (4, _('4 or +')))), 'house_maid': RadioSelect(choices=((0, '0'), (1, '1'), (2, '2'), (3, '3'), (4, _('4 or +')))), 'wash_machine': RadioSelect(choices=((0, '0'), (1, '1'), (2, '2'), (3, '3'), (4, _('4 or +')))), 'refrigerator': RadioSelect(choices=((0, '0'), (1, '1'), (2, '2'), (3, '3'), (4, _('4 or +')))), 'freezer': RadioSelect(choices=((0, '0'), (1, '1'), (2, '2'), (3, '3'), (4, _('4 or +')))), 'social_class': TextInput(attrs={'class': 'form-control', 'readonly': ""}) }
class Meta: model = Instructor fields = ['hobbies', 'profile_picture', 'first_name', 'last_name', 'city', 'city_district', 'zip_code', 'description', 'is_private_instructor', 'work_in_student_home', 'work_in_instructor_home', 'maximum_students', 'price', 'price_model'] widgets = { 'first_name': TextInput(attrs={'class': 'form-control', 'placeholder': 'Förnamn'}), 'last_name': TextInput(attrs={'class': 'form-control', 'placeholder': 'Efternamn'}), 'hobbies': RadioSelect(), 'city': TextInput(attrs={'class': 'form-control', 'placeholder': 'Stad... ex. Stockholm, Göteborg...'}), 'city_district': TextInput(attrs={'class': 'form-control', 'placeholder': 'Kommun: ex. Sollentuna, Täby...'}), 'zip_code': TextInput(attrs={'class': 'form-control', 'placeholder': 'Postnummer: ex. 123 45...'}), 'description': Textarea(attrs={'class': 'form-control', 'placeholder': 'Kort biografi om dig själv: Hej...', 'rows':20}), 'is_private_instructor': CheckboxInput(attrs={'class': 'bootstrap-switch', 'data-on-label': 'JA', 'data-off-label': 'NEJ', 'onchange': 'hide_show_instructor_fields()'}), 'work_in_student_home': CheckboxInput(), 'work_in_instructor_home': CheckboxInput(), 'maximum_students': NumberInput(attrs={'class': 'form-control', 'placeholder': 'Antal personer jag klan lära ut till per tillfälle'}), 'price': NumberInput(attrs={'class': 'form-control', 'placeholder': 'Pris per timme'}), 'price_model': RadioSelect(), } error_messages = { 'first_name': { 'required': _('Du måste fylla i ditt förnamn'), 'max_length': _('Texten du skrev in här var för långt'), }, 'last_name': { 'required': _('Du måste fylla i ditt efternamn'), 'max_length': _('Texten du skrev in här var för långt'), }, 'hobbies': { 'required': _('Du måste välja en hobby'), }, 'city': { 'required': _('Du måste fylla i din stad'), 'max_length': _('Texten du skrev in här var för långt'), }, 'city_district': { 'required': _('Du måste fylla i din kommun/stadsdel'), 'max_length': _('Texten du skrev in här var för långt'), }, 'zip_code': { 'required': _('Du måste fylla i ditt postnummer'), 'max_length': _('Texten du skrev in här var för långt'), }, 'description': { 'max_length': _('Texten du skrev in här var för långt, max 2500 tecken'), }, 'work_in_student_home': { }, 'work_in_instructor_home': { }, 'maximum_students': { 'required': _('Du måste fylla i hur många hobbyister du kan ta per gång'), 'max_length': _('Texten du skrev in här var för långt'), }, }
class Meta: model = Team fields = ('manager', 'team_name', 'email', 'team_type', 'formation', 'total_cost') widgets = { 'total_cost': HiddenInput(), 'team_type': RadioSelect(), 'formation': RadioSelect() }
class Meta: model = Resource exclude = ['reviewed', 'hidden', 'institution'] widgets = { 'type': CheckboxSelectMultiple(choices=Resource.TYPE_CHOICES), 'scope': RadioSelect(choices=Resource.SCOPE_CHOICES), # #todo -- license -- Question Type: Drop down menu with fill-in other 'license': RadioSelect(choices=Resource.LICENSE_CHOICES), 'audience': CheckboxSelectMultiple(choices=Resource.AUDIENCE_CHOICES), }
class Meta: model = Member exclude = ['position', 'expiration_date'] widgets = { 'callsign': TextInput(attrs={'size': 10}), 'address': TextInput(attrs={'size': 40}), 'state': TextInput(attrs={'size': 3}), 'email_address': EmailInput(attrs={'size': 40}), 'mailing_list': RadioSelect(choices=YES_NO_DROPDOWN), 'wd_online': RadioSelect(choices=YES_NO_DROPDOWN), 'arrl_member': RadioSelect(choices=YES_NO_DROPDOWN), 'need_new_badge': RadioSelect(choices=YES_NO_DROPDOWN), 'user': HiddenInput(), }
class Meta: model = UserProfile fields = ('trainee', 'driver_license', 'car_owner', 'afpa_center', 'gender',) widgets = { 'trainee': RadioSelect(attrs={'class': 'custom-control-input'}), 'driver_license': RadioSelect(attrs={'class': 'custom-control-input'}), 'car_owner': RadioSelect(attrs={'class': 'custom-control-input'}), 'afpa_center': Select(attrs={'class': 'custom-select'}), 'gender': Select(attrs={'class': 'custom-select'}) } labels = { 'afpa_center': 'Centre AFPA', 'gender': 'Genre', }
class Meta: model = Policy exclude = ['reviewed', 'hidden', 'institution'] widgets = { 'policy_type': RadioSelect(choices=Policy.POLICY_TYPE_CHOICES), 'scope': RadioSelect(choices=Policy.SCOPE_CHOICES), 'policy_level': RadioSelect(choices=Policy.POLICY_LEVEL_CHOICES), 'policy_definition': RadioSelect(choices=Policy.POLICY_DEFINITION_CHOICES), }
class Meta: fields = ( 'name', 'mac', 'ip', 'build_type', 'os_release', 'vlan', 'notes', ) model = models.Client widgets = { 'build_type': RadioSelect(), 'os_release': RadioSelect(), }
class ToolDetailedInfoForm(BaseModelForm): pricing = forms.ModelChoiceField( queryset=Pricing.objects.all(), empty_label=_('Not sure'), required=False, label=_('How much does this tool cost?'), widget=RadioSelect(attrs={'class': 'input-group radio'}) ) license = forms.ModelChoiceField( queryset=License.objects.all(), empty_label=_('Not sure'), required=False, label=_('Please choose a specific free / libre / open source license') ) sector = forms.ChoiceField( choices=[('no', _('No')), ('yes', _('Yes'))], required=True, initial='no', label=_('Is this tool for a specific sector or sectors?'), widget=RadioSelect(attrs={'class': 'input-group radio'}) ) class Meta: model = Tool fields = [ 'pricing', 'license_type', 'license', 'sectors', 'languages_supported', 'coop_made' ] labels = { 'license_type': _('How is this tool licensed?'), 'sectors': _('Please choose a sector or sectors:'), 'languages_supported': _('What languages does this tool support?'), 'coop_made': _('Was this tool created by a co-op?') } help_texts = { 'sectors': _('Hold down the <kbd>ctrl</kbd> (Windows) or <kbd>command</kbd> (macOS) key to select multiple options.'), 'languages_supported': _('Hold down the <kbd>ctrl</kbd> (Windows) or <kbd>command</kbd> (macOS) key to select multiple options.') } widgets = { 'license_type': RadioSelect(attrs={'class': 'input-group radio'}), 'coop_made': RadioSelect(attrs={'class': 'input-group radio'}) }
class Meta: model = Review fields = ('name', 'rating', 'review') widgets = { 'name': forms.TextInput( attrs={ 'type': 'text', 'class': 'form-control', 'id': 'name', 'aria-describedby': 'nameHelp', 'placeholder': 'Представтесь', 'name': 'name', 'data-cip-id': 'name' } ), 'rating': RadioSelect( choices=[ (1, '1'), (2, '2'), (3, '3'), (4, '4'), (5, '5') ] ), 'review': forms.Textarea( attrs={ 'class': 'form-control', 'id': 'content', 'placeholder': 'Содержание', 'name': 'description' } ), }
class Meta: model = Tarefa fields = ('descricao', 'tipoTarefa', 'nome') #exclude = ['utilizadorid'] widgets= { 'nome': TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Introduza o nome da tarefa', 'required': 'required', }), 'descricao': Textarea(attrs={ 'class': 'form-control', 'placeholder': 'Introduza a descrição da tarefa', 'required': 'required', }), 'tipoTarefa': RadioSelect(attrs={ 'class': 'form-check-input', 'required': 'required', }, choices = (('Atividade', 'Atividade'), ('Transporte', 'Transporte')) ) } labels= { 'nome': _('Nome'), 'descricao': _('Descrição'), 'tipoTarefa': _('Tipo de Tarefa') }
class SomeForm(Form): somechoice = ChoiceField( choices=(('\xc5', 'En tied\xe4'), ('\xf8', 'Mies'), ('\xdf', 'Nainen')), widget=RadioSelect(), label='\xc5\xf8\xdf', )
class OrganizationBasicInfoUpdateForm(BaseModelForm): type = forms.ModelChoiceField( Type.objects.filter(name__in=[ 'Cooperative', 'Potential cooperative', 'Shared platform' # 'Supporting organization' TODO: Add flow for these. ]), empty_label=None, label=_('How would you describe your organization?'), required=True, initial=0, widget=RadioSelect(attrs={'class': 'input-group radio'}) ) languages = forms.ModelMultipleChoiceField( queryset=Language.objects.all(), required=True, label=_('Working languages'), help_text=_('Hold down the <kbd>ctrl</kbd> (Windows) or <kbd>command</kbd> (macOS) key to select multiple options.') ) class Meta: model = Organization fields = [ 'type', 'name', 'languages', 'url' ] labels = { 'type': _('Organization type'), 'url': _('Website address') } help_texts = {}