class Meta: model = Project # fields that need to be filled out localized_fields = ('__all__') widgets = { 'title': forms.TextInput(attrs={'placeholder': 'e.g. Other Avenues Food Cooperative'}), 'tagline': forms.TextInput(attrs={'placeholder': 'e.g. Power the future!'}), 'funding_goal': forms.TextInput(attrs={'placeholder': 'e.g. $1000', 'min_value': 0, 'decimal_places': 2}), 'project_url': forms.TextInput(attrs={'placeholder': 'e.g. PowerCommunityDanceStudio2'}), 'impact_power': forms.NumberInput(attrs={'placeholder': 'e.g. 12.0'}), 'end_date': forms.DateInput(attrs={'placeholder': 'e.g. 10/25/2006', 'input_formats': '%m/%d/%Y'}), 'video_url': forms.URLInput(attrs={'placeholder': 'e.g. youtube.com/url_to_video'}), 'org_name': forms.TextInput(attrs={'placeholder': 'e.g. Other Avenues'}), 'org_start_date': forms.DateInput(attrs={'placeholder': 'e.g. 10/25/2006', 'input_formats': '%m/%d/%Y'}), 'org_about': forms.Textarea(attrs={ 'placeholder': 'e.g. Other Avenues is a worker-owned cooperative that seeks to maintain a thriving business while providing food and supplies for sustainable living, supporting organic and local farms and to serve as a model of workplace democracy for the community.'}), 'location': forms.TextInput(attrs={'placeholder': 'e.g. 3930 Judah Street San Francisco, CA 94122'}), 'description': forms.Textarea(attrs={ 'placeholder': "e.g. The solar energy system will be a 36kW project that provides 33% of Other Avenue's electricity needs."}), 'people_affected': forms.NumberInput(attrs={'placeholder': 'e.g. 12'}), # 'actual_energy': forms.TextInput(attrs={'placeholder': 'e.g. 10000', 'min_value': 0, 'decimal_places': 2}), 'total_kwh_value': forms.NumberInput(attrs={'placeholder': 'e.g. 50000'}), } fields = ( 'title', 'tagline', 'funding_goal', 'impact_power', 'end_date', 'video_url', 'cover_photo', 'org_name', 'org_about', 'org_start_date', 'location', 'location_latitude', 'location_longitude', 'categories_select', 'description', 'people_affected', # 'actual_energy', 'total_kwh_value', 'project_url' )
class JasminForm(ClaimViewMixin.Form): country = forms.ChoiceField( choices=ALL_COUNTRIES, widget=SelectWidget(attrs={"searchable": True}), label=_("Country"), help_text=_("The country this phone number is used in"), ) number = forms.CharField( max_length=14, min_length=3, label=_("Number"), help_text=_("The short code or phone number you are connecting."), ) url = ExternalURLField( widget=forms.URLInput( attrs={"placeholder": _("Ex: https://jasmin.gateway.io/send") }), label=_("URL"), help_text=_("The URL for the Jasmin server send path"), ) username = forms.CharField( label=_("Username"), help_text=_("The username to be used to authenticate to Jasmin")) password = forms.CharField( label=_("Password"), help_text=_("The password to be used to authenticate to Jasmin")) def clean_number(self): number = self.data["number"] # number is a shortcode, accept as is if len(number) > 0 and len(number) < 7: return number # otherwise, try to parse into an international format if number and number[0] != "+": number = "+" + number try: cleaned = phonenumbers.parse(number, None) return phonenumbers.format_number( cleaned, phonenumbers.PhoneNumberFormat.E164) except Exception: # pragma: needs cover raise forms.ValidationError( _("Invalid phone number, please include the country code. ex: +250788123123" ))
class EmployeeForm(forms.ModelForm): fullname = forms.CharField(widget=forms.TextInput( attrs={'class': 'form-control'})) contact_no = forms.CharField(widget=forms.TextInput( attrs={'class': 'form-control'})) address = forms.CharField(widget=forms.TextInput( attrs={'class': 'form-control'})) qualification = forms.CharField(widget=forms.TextInput( attrs={'class': 'form-control'})) website = forms.URLField(widget=forms.URLInput( attrs={'class': 'form-control'})) class Meta: model = Employee # fields = '__all__' # for all fields # fields = ['fullname', 'contact_no'] # for only neede exclude = ['user']
class Meta: model = RadioStation exclude = ('slug', ) widgets = { 'name': forms.TextInput(attrs={ 'class': 'form-control-sm', 'placeholder': 'Awesome Radio\'s name' }), 'url': forms.URLInput( attrs={ 'class': 'col-form-label-lg', 'placeholder': 'Add streaming url, not the radio\'s site page!' }), }
class Meta: model = Source # Use HTML5 input types to get widgets and do some client-side # validation fields = [ 'url', ] labels = { 'url': _("Source URL"), } widgets = { 'url': forms.URLInput(attrs={ 'class': DEFAULT_FORM_WIDGET_CLASS, }), }
class Meta: model = Profile fields = ['url', 'email', 'mobile'] widgets = { 'url': forms.URLInput( attrs={'placeholder': 'Enter your website / blog url'}), 'email': forms.EmailInput( attrs={'placeholder': 'Enter your email address '}), 'mobile': forms.TextInput( attrs={ 'placeholder': 'Enter your mobile number', 'style': 'max-length:11' }), }
class Meta: model = Profile fields = ['avatar', 'bio', 'link'] widgets = { 'avatar':forms.ClearableFileInput(attrs={ 'class':'form-control-file mt-3' }), 'bio':forms.Textarea(attrs={ 'class':'form-control mt-3', 'rows':3, 'placeholder':'Biografía' }), 'link':forms.URLInput(attrs={ 'class':'form-control mt-3', 'placeholder':'Enlace' }) }
class Meta: model = cyclists.models.Cyclist fields = [ 'targetAmount', 'currentPledgedAmount', 'fundraising_site', 'statement' ] widgets = { 'targetAmount': forms.fields.NumberInput(attrs={ 'size': 7, 'min': '0' }), 'currentPledgedAmount': forms.fields.NumberInput(attrs={ 'size': 7, 'min': '0' }), 'statement': forms.Textarea(attrs={ 'cols': 40, 'rows': 10 }), 'fundraising_site': forms.URLInput(attrs={'size': 40}) } help_texts = { 'targetAmount': 'How much do you hope to raise', 'currentPledgedAmount': 'How much do you currently have pledged', 'fundraising_site': 'Your fundraising site on MyDonate.com, FundMe.com or similar', 'statement': 'Your personal statement as to why you are raising participating. (This will appear on your personal FundMe page).' } labels = { 'targetAmount': u"Target £", 'currentPledgedAmount': u'Current Pledges £', 'fundraising_site': 'Your Personal fundraising Site', 'statement': 'Your personal statement' } def __init__(self, *args, **kwargs): super(FundRaising, self).__init__(*args, **kwargs) self.fields['currentPledgedAmount'].required = False self.fields['targetAmount'].required = False
class LasyaRegistrationForm(forms.Form): understood = forms.BooleanField() referral_code = forms.CharField( max_length=50, label="Referral Code", widget=forms.TextInput(attrs={ 'placeholder': 'Code', }), required=False) name = forms.CharField( max_length=200, label="Your Team Name", widget=forms.TextInput(attrs={ 'placeholder': 'Team Name', })) institution = forms.CharField( max_length=200, label="Name of Your Institution (if applicable)", widget=forms.TextInput(attrs={ 'placeholder': 'Name of Institution', }), required=False) prelims_video = forms.FileField( validators=[VIDEO_FILE_VALIDATOR], label="Video for Prelims", widget=forms.ClearableFileInput(attrs={ 'placeholder': 'Prelims Video', }), required=False) prelims_video_link = forms.URLField( label="Link to Prelims Video", widget=forms.URLInput(attrs={ 'placeholder': 'Prelims Video URL', }), required=False) contact = PhoneNumberField.get_field( as_regexField=True, max_length=13, label="Team's Contact No.", widget=forms.TextInput(attrs={ 'placeholder': "Team's Mobile No.", })) email = forms.EmailField( label="Team's E-Mail ID", widget=forms.TextInput(attrs={ 'placeholder': "Team's E-Mail ID", }))
class Meta: model = Member fields = ( 'photo', 'firstname', 'lastname', 'email', 'description', 'position', 'expertise', 'facebook', 'twitter', 'instagram', 'website', ) widgets = { 'description': forms.Textarea(attrs={ 'rows': 3, 'cols': 20, 'id': 'member-description', }), 'expertise': forms.Textarea(attrs={ 'rows': 3, 'cols': 20, 'id': 'member-expertise', }), 'facebook': forms.TextInput(attrs={ 'id': 'member-facebook', }), 'twitter': forms.TextInput(attrs={ 'id': 'member-twitter', }), 'instagram': forms.TextInput(attrs={ 'id': 'member-instagram', }), 'website': forms.URLInput(attrs={ 'id': 'member-website', }), }
class Meta: # super(EducationForm.Meta) model = Certificate fields = ('show_img', 'img', 'link',) widgets = { 'img': forms.FileInput(attrs={'class': 'form-control-file'}), 'link': forms.URLInput(attrs={'class': 'form-control'}), } data = { # each form field data with a proper index form 'cert_form-0-raw': 'cert_form', # form status, number of forms 'cert_form-INITIAL_FORMS': 1, 'cert_form-TOTAL_FORMS': 2, }
class Meta: model = T_D_Info fields = ['title', 'url'] widgets = { 'title': forms.Textarea(attrs={ 'cols': 50, 'rows': 1, 'style': "width:80%" }), 'url': forms.URLInput(attrs={ 'cols': 50, 'rows': 1, 'style': "width:80%" }), }
class Meta: model = ngo fields = [ 'name', 'username', 'email', 'password', 'ph', 'link', 'text' ] widgets = { 'name': forms.TextInput(attrs={'class': "form-control"}), 'username': forms.TextInput(attrs={'class': "form-control"}), 'email': forms.EmailInput(attrs={'class': "form-control"}), 'password': forms.PasswordInput(attrs={'class': "form-control"}), 'ph': forms.TextInput(attrs={'class': "form-control"}), 'link': forms.URLInput(attrs={'class': "form-control"}), 'text': forms.Textarea(attrs={ 'class': "form-control", 'rows': 3 }), }
class Meta: model = Url fields = ["original_url", "short_url"] widgets = { "short_url": forms.TextInput( attrs={ "class": "form-control pl-4 pr-4", "placeholder": "Your short URL(optional)", }), "original_url": forms.URLInput(attrs={ "class": "form-control pl-4 pr-4", "placeholder": "Your URL" }), }
class CommentForm(forms.Form): name = forms.CharField(label='输入名字', required=True, widget=forms.TextInput(attrs={'id': 'id_name'})) email = forms.EmailField(label='输入邮箱', required=True, widget=forms.EmailInput(attrs={'id': 'id_email'})) url = forms.URLField(label='输入个人主页', required=True, widget=forms.URLInput(attrs={'id': 'id_url'})) comment = forms.CharField( label='输入评论内容', required=True, widget=forms.Textarea(attrs={'id': 'id_comment'}))
class LinksAndSocialMedia(forms.Form): """ LINKS & SOCIAL MEDIA -------------------- - URLs - Facebook - Twitter - LinkedIn - Github - Instragram """ url0 = forms.URLField(required=False, widget=forms.URLInput(attrs={'class': 'org_manage_field'})) url1 = forms.URLField(required=False, widget=forms.URLInput(attrs={'class': 'org_manage_field'})) url2 = forms.URLField(required=False, widget=forms.URLInput(attrs={'class': 'org_manage_field'})) facebook = forms.URLField(required=False, widget=forms.URLInput(attrs={'class': 'org_manage_field'})) twitter = forms.URLField(required=False, widget=forms.URLInput(attrs={'class': 'org_manage_field'})) linkedin = forms.URLField(required=False, widget=forms.URLInput(attrs={'class': 'org_manage_field'})) github = forms.URLField(required=False, widget=forms.URLInput(attrs={'class': 'org_manage_field'})) instagram = forms.URLField(required=False, widget=forms.URLInput(attrs={'class': 'org_manage_field'}))
class VenueForm(forms.Form): name = forms.CharField(max_length=200, label="Venue Name", label_suffix='', widget=forms.TextInput(attrs={'class': "form-control"})) brief_name = forms.CharField(max_length=200, label="Brief Name", label_suffix='', widget=forms.TextInput(attrs={'class': "form-control"}), required=False) website_url = forms.URLField(label="Venue Website", label_suffix='', widget=forms.URLInput(attrs={'class': "form-control"}), required=False) street_address = forms.CharField(max_length=200, label="Street Address", label_suffix='', widget=forms.TextInput(attrs={'class': "form-control"}), required=False) city = forms.CharField(max_length=200, label="City", label_suffix='', widget=forms.TextInput(attrs={'class': "form-control"}), required=False) state = forms.CharField(max_length=200, label="State", label_suffix='', widget=forms.TextInput(attrs={'class': "form-control"}), required=False) zip_code = forms.IntegerField(label="Zip Code", label_suffix='', widget=forms.NumberInput(attrs={'class': "form-control"}), required=False) image = forms.ImageField(label="Picture", label_suffix='', widget=forms.ClearableFileInput(attrs={'class': "form-control"}), required=False) description = forms.CharField(max_length=10000, label="Description", label_suffix='', widget=forms.Textarea(attrs={ 'class': "form-control", 'rows': 15, }), required=False)
class Meta: model = Jcpaper fields = [ 'title', 'journal', 'hwl_recommend', 'presenter', 'file', 'location', 'time', 'link', 'content' ] widgets = { 'title': forms.TextInput(attrs={ 'class': 'form-control', 'placeholder': '' }), 'journal': forms.TextInput(attrs={ 'class': 'form-control', 'placeholder': 'ex: PNAS' }), 'location': forms.TextInput(attrs={ 'class': 'form-control', 'placeholder': "ex: B471" }), 'time': DateTimePickerInput(), 'link': forms.URLInput(attrs={ 'class': 'form-control', 'placeholder': 'ex: https://... ' }), 'content': forms.TextInput( attrs={ 'class': 'form-control', 'placeholder': 'What do you want to say....' }), } labels = { 'title': 'Paper Title', 'journal': "Journal", 'hwl_recommend': "HWL recommend?", 'location': 'Location', 'time': 'Time', 'link': 'URL link for paper', 'content': 'Content', }
class Meta: model = Idea fields = ('title', 'hashtag', 'tagline', 'description', 'lots', 'website', 'video') widgets = { 'lots': autocomplete_light.MultipleChoiceWidget('LotAutocomplete'), 'hashtag': forms.TextInput( attrs={ 'class': 'form-control', 'placeholder': 'The twitter hashtag of your project. Include #.' }), 'tagline': forms.Textarea( attrs={ 'rows': 2, 'class': 'form-control', 'placeholder': 'A short description of your project' }), 'description': forms.Textarea( attrs={ 'rows': 20, 'class': 'form-control', 'placeholder': 'Tell us more in-depth about your project' }), 'website': forms.URLInput( attrs={ 'class': 'form-control', 'placeholder': 'The url of the project website. Include http://' }), 'video': forms.TextInput( attrs={ 'class': 'form-control', 'placeholder': 'A link to a YouTube or Vimeo video' }), }
class Meta: """Meta class""" model = Shares fields = '__all__' widgets = { 'name': forms.TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Name of the Shares' }), 'pub_date': forms.DateInput(format=('%Y-%m-%d'), attrs={'type': 'date'}), 'description': forms.Textarea(attrs={ 'class': 'form-control', 'placeholder': 'Descripton of the Shares' }), 'status': forms.Select(attrs={'class': 'form-control'}), 'preview': forms.FileInput(attrs={ 'class': 'form-control', 'placeholder': 'Preview of the Shares' }), 'video': forms.URLInput(attrs={ 'class': 'form-control', 'placeholder': 'URL of video' }), 'seo_title': forms.TextInput(attrs={ 'class': 'form-control', 'placeholder': 'SEO Title' }), 'seo_keywords': forms.TextInput(attrs={ 'class': 'form-control', 'placeholder': 'SEO Keywords' }), 'seo_description': forms.TextInput(attrs={ 'class': 'form-control', 'placeholder': 'SEO Discriprions' }), }
class Meta: model = models.Resume fields = [ 'name', 'surname', 'status', 'salary', 'specialty', 'grade', 'education', 'experience', 'portfolio' ] widgets = { 'name': forms.TextInput(attrs={'class': 'form-control'}), 'surname': forms.TextInput(attrs={'class': 'form-control'}), 'status': forms.Select(attrs={'class': 'form-control'}, ), 'salary': forms.NumberInput(attrs={'class': 'form-control'}), 'specialty': forms.Select(attrs={'class': 'form-control'}, ), 'grade': forms.Select(attrs={'class': 'form-control'}, ), 'education': forms.Textarea(attrs={ 'class': 'form-control', 'rows': 4, 'style': "color:#000;" }), 'experience': forms.Textarea(attrs={ 'class': 'form-control', 'rows': 4, 'style': "color:#000;" }), 'portfolio': forms.URLInput(attrs={'class': 'form-control'}), } labels = { 'name': 'Имя', 'surname': 'Фамилия', 'status': 'Готовность к работе', 'salary': 'Ожидаемое вознаграждение', 'specialty': 'Специализация', 'grade': 'Квалификация', 'education': 'Образование', 'experience': 'Опыт работы', 'portfolio': 'Ссылка на портфолио', }
class RepositoryForm(forms.Form): """Form to register a new repository.""" name = forms.CharField( label="Instance Name", max_length=100, required=True, widget=forms.TextInput(attrs={"class": "form-control"}), validators=[BlankSpacesValidator()], ) endpoint = forms.URLField( label="Endpoint", required=True, widget=forms.URLInput(attrs={"class": "form-control"}), ) username = forms.CharField( label="Username", max_length=100, required=True, widget=forms.TextInput(attrs={"class": "form-control"}), ) password = forms.CharField( label="Password", widget=forms.PasswordInput(attrs={"class": "form-control"}), required=True, ) client_id = forms.CharField( label="Client ID", max_length=100, required=True, widget=forms.TextInput(attrs={"class": "form-control"}), ) client_secret = forms.CharField( label="Client Secret", max_length=100, required=True, widget=forms.TextInput(attrs={"class": "form-control"}), ) timeout = forms.IntegerField( label="Timeout (s)", min_value=1, max_value=60, initial=1, widget=forms.NumberInput(attrs={"class": "form-control"}), )
class ShortURLForm(forms.ModelForm): url = forms.URLField(label='URL', required=True, widget=forms.URLInput(attrs={'class': 'form-control'})) costumer_code = forms.CharField(label='Preferred Code', required=False, widget=forms.TextInput(attrs={'class': 'form-control'}),) class Meta: model = ShortingURL fields = ['url', 'costumer_code'] def clean_costumer_code(self): data = self.cleaned_data.get('costumer_code') if len(data) < 6 and data: raise forms.ValidationError('The length of the code must be at least 6 letters.') qs = ShortingURL.objects.filter(shortcode=data).exists() if qs: raise forms.ValidationError('The code you wrote is taken') return data
class Meta: model = Contact fields = '__all__' exclude = ('user', 'created') widgets = { 'first_name': forms.TextInput(attrs={'placeholder': 'First Name..', 'class': 'form-control bg-custom text-white rounded'}), 'phone_number': forms.NumberInput(attrs={'placeholder': 'Phone Number..', 'class': 'form-control bg-custom text-white rounded'}), 'email': forms.EmailInput(attrs={'placeholder': 'Email..', 'class': 'form-control bg-custom text-white rounded'}), 'category': forms.Select(attrs={'class': 'form-control custom-select bg-custom text-muted'}), 'company_name': forms.TextInput(attrs={'placeholder': 'Company..', 'class': 'form-control bg-custom text-white rounded'}), 'job': forms.TextInput(attrs={'placeholder': 'Job..', 'class': 'form-control bg-custom text-white rounded'}), 'website': forms.URLInput(attrs={'placeholder': 'Website..', 'class': 'form-control bg-custom text-white rounded'}), 'address': forms.TextInput(attrs={'placeholder': 'Address..', 'class': 'form-control bg-custom text-white rounded'}), 'city': forms.TextInput(attrs={'placeholder': 'City..', 'class': 'form-control bg-custom text-white rounded'}), 'country': forms.TextInput(attrs={'placeholder': 'Country..', 'class': 'form-control bg-custom text-white rounded'}), 'avatar': forms.ClearableFileInput(attrs={'class': 'custom-file-input'}), 'description': forms.Textarea(attrs={'placeholder': 'Notes..', 'class': 'form-control bg-custom text-white rounded'}), }
class LinkForm(forms.Form): full_link = forms.URLField( widget=forms.URLInput(attrs={ 'class': 'form-control form-control-lg', 'placeholder': 'Input your link for shortener', 'aria-label': "Recipient's", 'aria-describedby': 'button-addon2' }) ) designed_link = forms.CharField( max_length=20, min_length=6, required=False, widget=forms.TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Enter which link you would like' }) )
class Meta: model = models.Listing exclude = ["user", "status"] widgets = { "title": forms.TextInput(attrs={"class": "form-control"}), "description": forms.Textarea(attrs={ "class": "form-control", "rows": 10 }), "image_url": forms.URLInput(attrs={"class": "form-control"}), "category": forms.Select(attrs={"class": "form-control"}), "starting_bid": forms.NumberInput(attrs={"class": "form-control"}) }
class ScreenshotForm(forms.Form): target_url = forms.URLField( max_length=500, min_length=5, widget=forms.URLInput(attrs={'class': 'form-control'})) height = forms.IntegerField(widget=forms.NumberInput(attrs={ 'class': 'form-control', 'value': '1080' }), validators=[validators.MinValueValidator(420)]) width = forms.IntegerField(widget=forms.NumberInput(attrs={ 'class': 'form-control', 'value': '1920' }), validators=[validators.MinValueValidator(420)])
class PublisherForm(forms.ModelForm): name = forms.CharField(widget=forms.TextInput( attrs={'class': 'form-control'})) address = forms.CharField(widget=forms.TextInput( attrs={'class': 'form-control'})) city = forms.CharField(widget=forms.TextInput( attrs={'class': 'form-control'})) state_province = forms.CharField(widget=forms.TextInput( attrs={'class': 'form-control'})) country = forms.CharField(widget=forms.TextInput( attrs={'class': 'form-control'})) website = forms.URLField(widget=forms.URLInput( attrs={'class': 'form-control'})) class Meta: model = Publisher fields = ('name', 'address', 'city', 'state_province', 'country', 'website')
def __init__(self, field_format, *args, **kwargs): super().__init__(*args, **kwargs) self.field_format = field_format if field_format == StateFieldFormats.URL: self.fields["text"].widget = forms.URLInput() self.fields["text"].label = "URL" elif field_format == StateFieldFormats.BOOLEAN: self.fields["text"] = forms.ChoiceField( choices=[("True", "True"), ("False", "False")], label="Boolean", widget=forms.RadioSelect, ) elif field_format == StateFieldFormats.DATE: self.fields["text"].widget = forms.TextInput() self.fields["text"].label = "Date" self.fields["text"].help_text = "A date in the format YYYY-MM-DD" else: self.fields["text"].help_text = "Markdown allowed"
class Meta: YEARS = [ '2000', '2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014', '2015', '2016', '2017', '2018' ] model = Startup fields = '__all__' widgets = { 'name': forms.TextInput(attrs={'class': 'form-control'}), 'slug': forms.TextInput(attrs={'class': 'form-control'}), 'description': forms.Textarea(attrs={'class': 'form-control'}), 'founded_date': forms.SelectDateWidget(years=YEARS), 'contact': forms.EmailInput(attrs={'class': 'form-control'}), 'website': forms.URLInput(attrs={ 'class': 'form-control', }) }