class Meta: model = Organization fields = [ 'name', 'url', 'email', 'address', 'city', 'state', 'postal_code', 'country', 'founded', 'media_url', 'logo_url', ] labels = { 'name': _('What is the name of your enterprise or project?'), 'url': _('What is the URL of your enterprise or project?'), 'email': _('What is the general contact email address for your enterprise or project?' ), 'socialnetworks': _('What are the social media handles of your enterprise or project?' ), 'address': _( safe( 'What is the physical address of the headquarters of your enterprise or project?<br/> Street' )), 'state': _('State or province'), 'founded': _( safe( 'When was your enterprise or project founded? (Year required. <span class="required"> *</span>)' )), 'media_url': _('Paste a link to photos or any introductory video about your enterprise or project:' ), 'logo_url': _('Paste a link to the logo for your enterprise or project:'), } help_texts = {} widgets = { 'url': URLInput(attrs={'placeholder': 'e.g., https://example.coop/'}), 'founded': DateSelectorWidget(), 'media_url': URLInput(attrs={ 'placeholder': 'e.g., https://www.youtube.com/watch?v=qcPUARqRsVM' }), 'logo_url': URLInput( attrs={'placeholder': 'e.g., https://example.coop/logo.png'}), }
class DocumentationForm(ModelForm): class Meta: model = Documentation fields = ['tz_link', 'ptz_link'] widjets = { "tz_link": URLInput(attrs={'placeholder': 'TYPE'}), "ptz_link": URLInput(attrs={'placeholder': 'TYPE'}) }
class Meta: model = models.MobileApp fields = ['app_name', 'app_description', 'app_main_image', 'app_image1', 'app_image2', 'app_image3', 'app_image4', 'app_image5', 'app_apple', 'app_google', 'status'] widgets = { 'app_name': TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Введите название мобильного приложение', 'id': 'NameInput', }), 'app_description': Textarea(attrs={ 'class': 'form-control', 'id': 'TextInput', 'rows': '5', 'placeholder': 'Введите описание мобильного приложение', }), 'app_main_image': FileInput(attrs={ 'class': 'upload', 'id': 'Poster', }), 'app_image1': FileInput(attrs={ 'class': 'upload', 'id': 'Image1', }), 'app_image2': FileInput(attrs={ 'class': 'upload', 'id': 'Image2', }), 'app_image3': FileInput(attrs={ 'class': 'upload', 'id': 'Image3', }), 'app_image4': FileInput(attrs={ 'class': 'upload', 'id': 'Image4', }), 'app_image5': FileInput(attrs={ 'class': 'upload', 'id': 'Image5', }), 'app_apple': URLInput(attrs={ 'class': 'form-control', 'id': 'MainSlideURL', 'placeholder': 'Введите ссылку на приложение из AppStore', }), 'app_google': URLInput(attrs={ 'class': 'form-control', 'id': 'MainSlideURL', 'placeholder': 'Введите ссылку на приложение из PlayMarket', }), }
class Meta: model = models.SEO fields = ['seo_title', 'seo_keywords', 'seo_description', 'seo_url'] widgets = { 'seo_title': Textarea(attrs={ 'class': 'form-control', 'placeholder': 'Введите заголовок', 'rows': '5', 'id': 'TitleInput', }), 'seo_keywords': Textarea(attrs={ 'class': 'form-control', 'placeholder': 'Введите ключевые слова', 'rows': '5', 'id': 'KeywordsInput', }), 'seo_description': Textarea(attrs={ 'class': 'form-control', 'id': 'DescriptionInput', 'rows': '5', 'placeholder': 'Введите описание', }), 'seo_url': URLInput(attrs={ 'class': 'form-control', 'placeholder': 'Введите ссылку', 'id': 'URLInput', }), }
class Meta: model = models.NewsPromoSlide fields = ['slide_text', 'slide_image', 'slide_url', 'slide_timer'] widgets = { 'slide_image': FileInput(attrs={ 'class': 'upload', 'id': 'MainSlideImage', }), 'slide_text': Textarea(attrs={ 'class': "form-control", 'rows': '5', 'id': "MainSlideText", }), 'slide_url': URLInput(attrs={ 'class': 'form-control', 'id': 'MainSlideURL', 'placeholder': 'Введите ссылку слайда', }), 'slide_timer': TextInput(attrs={ 'class': 'form-control', 'id': 'NewsPromoNumber', 'placeholder': 'Введите cкорость', }), }
class Meta: model = Employer fields = ['city', 'phonenumber', 'website', 'companyname'] widgets = { 'phonenumber': NumberInput( attrs={ 'class': 'form-control', 'id': 'phonenumber', 'placeholder': 'Your phone number' }), 'companyname': TextInput( attrs={ 'class': 'form-control', 'id': 'companyname', 'placeholder': 'Your company name' }), 'website': URLInput( attrs={ 'class': 'form-control', 'id': 'website', 'placeholder': 'Your website' }), }
class Meta: model = Tool fields = ['title', 'link', 'desc'] widgets = { 'title': TextInput(attrs={ 'class': 'review-input', 'placeholder': 'Tool Title' }), 'link': URLInput(attrs={ 'class': 'review-input', 'placeholder': 'Tool Link' }), 'desc': Textarea(attrs={ 'class': 'review-textarea', 'placeholder': "Tool's Description" }), } labels = { 'title': '', 'link': '', 'desc': '', }
def get_form(self, model, *args, **kwargs): Form = modelform_factory( model, exclude=['created', 'updated', 'owner'], widgets={ 'title': TextInput(attrs={ 'placeholder': "Content Title", 'class': 'form-control' }), 'url': URLInput(attrs={ 'placeholder': 'Video URL', 'class': 'form-control' }), 'image': FileInput(attrs={'class': 'form-control'}), 'file': FileInput(attrs={'class': 'form-control'}), 'content': Textarea(attrs={ 'placeholder': 'Text Content', 'class': 'form-control' }) }) return Form(*args, **kwargs)
class Meta: model = Contact fields = ['listName','businessName','contactName','address1', 'address2','address3','address4','postCode', 'telephone','mobile','fax','email', 'website','categories','notes','picture'] widgets = { 'listName': TextInput(attrs={'class':'form-control','id':'listName','name':'listName','required':'','data-error':'Debe ingresar el Nombre de Lista'}), 'businessName': TextInput(attrs={'class':'form-control','id':'businessName','name':'businessName'}), 'contactName': TextInput(attrs={'class':'form-control','id':'contactName','name':'contactName','required':''}), 'address1': TextInput(attrs={'class':'form-control','id':'address1','name':'address1','required':''}), 'address2': TextInput(attrs={'class':'form-control','id':'address2','name':'address2'}), 'address3': TextInput(attrs={'class':'form-control','id':'address3','name':'address3'}), 'address4': TextInput(attrs={'class':'form-control','id':'address4','name':'address4'}), 'postCode': TextInput(attrs={'class':'form-control','id':'postCode','name':'postCode'}), 'telephone': TextInput(attrs={'class':'form-control','id':'telephone','name':'telephone'}), 'mobile': TextInput(attrs={'class':'form-control','id':'mobile','name':'mobile'}), 'fax': TextInput(attrs={'class':'form-control','id':'fax','name':'fax'}), 'email': EmailInput(attrs={'class':'form-control','id':'email','name':'email'}), 'website': URLInput(attrs={'class':'form-control','id':'website','name':'website'}), 'categories': RadioSelect(attrs={'class':'radio','id':'categories','name':'categories'}), 'notes': Textarea(attrs={'class':'form-control','id':'notes','name':'notes','rows':'8'}), 'picture': ClearableFileInput(attrs={'name':'picture','id':'picture','style':'height:35px;'}) }
class ActEditDraftForm(ModelForm): required_css_class = 'required' error_css_class = 'error' act_duration = DurationFormField( required=False, help_text=act_help_texts['act_duration'] ) track_duration = DurationFormField( required=False, help_text=act_help_texts['track_duration'], label=act_bid_labels['track_duration'] ) track_artist = CharField(required=False) track_title = CharField(required=False) shows_preferences = MultipleChoiceField( widget=CheckboxSelectMultiple, choices=act_shows_options, label=act_bid_labels['shows_preferences'], help_text=act_help_texts['shows_preferences'], required=False ) other_performance = MultipleChoiceField( widget=CheckboxSelectMultiple, choices=act_other_perf_options, label=act_bid_labels['other_performance'], help_text=act_help_texts['other_performance'], required=False ) video_link = URLField( widget=URLInput(attrs={'placeholder': 'http://'}), help_text=act_help_texts['video_link'], label=act_bid_labels['video_link'], required=False ) b_conference = HiddenInput() class Meta: model = Act fields = [ 'performer', 'shows_preferences', 'other_performance', 'b_title', 'track_title', 'track_artist', 'track_duration', 'act_duration', 'video_link', 'video_choice', 'b_description', 'why_you', 'b_conference', 'act_duration', 'track_duration', 'track_artist', 'track_title'] labels = act_bid_labels help_texts = act_help_texts widgets = {'b_conference': HiddenInput()}
class DocMarkForm(ModelForm): class Meta: model = DocMark fields = ['rpz_accept'] widjets = { "rpz_accept": URLInput(attrs={'placeholder': 'TYPE'}), }
class Meta: model = InvestmentIdea fields = ['title', 'picture_or_video_URL', 'description'] widgets = { 'title': TextInput(attrs={'class': 'form-control'}), 'description': Textarea(attrs={'class': 'form-control'}), 'picture_or_video_URL': URLInput(attrs={'class': 'form-control'}), }
class Meta: model = Contribution fields = ['url', 'title', 'text'] widgets = { 'url': URLInput(attrs={'size': 50}), 'title': TextInput(attrs={'size': 50, 'required': False}), 'text': Textarea(attrs={'cols': 49, 'rows': 4, 'required': False}), }
class Meta: model = Post fields =['title','url','content'] widgets = { 'content' : Textarea(attrs={'class': 'form-control','rows':4}), 'url' : URLInput(attrs={'class': 'form-control'}), 'title' : TextInput(attrs={'class': 'form-control'}), }
class Meta: model = HeroCarousal fields = '__all__' widgets = { 'alt_text': TextInput(attrs={'class':'form-control'},), 'carousal_image': FileInput(attrs={'class': 'form-control'}), 'url_link': URLInput(attrs={'class': 'form-control'}), 'status': Select(attrs={'class': 'form-control'}), 'caption': TextInput(attrs={'class':'form-control'}), }
class ProfileForm(ModelForm): name = CharField(widget=TextInput(), label=_("Name")) surname = CharField(widget=TextInput(), label=_("Surname")) email = EmailField(widget=EmailInput(), label=_("Email")) city = CharField(widget=TextInput(), label=_("City")) postalCode = CharField(widget=NumberInput(), label=_("Postal Code")) idCardNumber = CharField(widget=TextInput(), label=_("IDCard Number")) dateOfBirth = DateField(widget=DateInput(), label=_("Date of birth")) phoneNumber = CharField(widget=NumberInput(), label=_("Phone Number")) photo = URLField(widget=URLInput(), label=_("Photo URL:")) class Meta: model = Profile exclude = () def __init__(self, *args, **kwargs): print('__init__ ProfileForm') super(ProfileForm, self).__init__(*args, **kwargs) self.fields['user'].required = False data = kwargs.get('data') # 'prefix' parameter required if in a modelFormset self.instance.user = User() self.user_form = UserForm(instance=self.instance and self.instance.user, prefix=self.prefix, data=data) def clean_phoneNumber(self): print('clean: ProfileForm: PhoneNumber') data = self.cleaned_data['phoneNumber'] if not data.isdigit(): raise ValidationError(_("Phone Number must be a number")) return data def clean_dateOfBirth(self): print('clean: ProfileForm: dateOfBityh') data = self.cleaned_data['dateOfBirth'] from_date = datetime.now() - timedelta(days=18 * 365) print(str(from_date)) print(str(data)) if data > datetime.date(from_date): raise ValidationError(_("You must be over 18 to sign up")) return data def clean(self): print('clean: ProfileForm') if not self.user_form.is_valid(): raise forms.ValidationError(_("User not valid")) def save(self, commit=False): print('save: ProfileForm') obj = super(ProfileForm, self).save(commit=commit) obj.user = self.user_form.save() obj.save() return obj
class Meta: model = models.Promotion fields = ['promo_name', 'promo_description', 'promo_main_image', 'promo_image1', 'promo_image2', 'promo_image3', 'promo_image4', 'promo_image5', 'promo_url', 'promo_published_date', 'promo_status'] widgets = { 'promo_name': TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Введите название акции', 'id': 'PromotionNameInput', }), 'promo_description': Textarea(attrs={ 'class': 'form-control', 'id': 'PromotionTextInput', 'rows': '5', 'placeholder': 'Введите описание акции', }), 'promo_main_image': FileInput(attrs={ 'class': 'upload', 'id': 'PromotionMainImage', }), 'promo_image1': FileInput(attrs={ 'class': 'upload', 'id': 'PromoImage', }), 'promo_image2': FileInput(attrs={ 'class': 'upload', 'id': 'PromoImage1', }), 'promo_image3': FileInput(attrs={ 'class': 'upload', 'id': 'PromoImage2', }), 'promo_image4': FileInput(attrs={ 'class': 'upload', 'id': 'PromoImage3', }), 'promo_image5': FileInput(attrs={ 'class': 'upload', 'id': 'PromoImage4', }), 'promo_url': URLInput(attrs={ 'class': 'form-control', 'placeholder': 'Введите ссылку на акцию', 'id': 'PromotionUrl', }), 'promo_published_date': DateInput(format=('%Y-%m-%d'), attrs={ 'type': "date", 'placeholder': "Введите дату публикации", 'class': "form-control", 'id': "PromotionPublishedDate", }), }
class Meta: model = Company fields = ['name', 'website', 'address', 'phone', 'email', 'logo', ] widgets = { 'name': TextInput(attrs={'class': 'form-control', 'placeholder': 'Empresa'}), 'website': URLInput(attrs={'class': 'form-control'}), 'address': TextInput(attrs={'class': 'form-control', 'placeholder': 'Endereço completo'}), 'phone': TextInput(attrs={'class': 'form-control', 'placeholder': 'Telefone'}), 'email': EmailInput(attrs={'class': 'form-control', 'placeholder': 'Email'}), }
class UrlForm(forms.Form): url = forms.Field(widget=URLInput(), required=True, label='Paste your URL here') def clean_url(self): url = self.cleaned_data.get('url') try: validator = URLValidator() validator(url) except forms.ValidationError: raise forms.ValidationError('Please enter a valid URL.') return url
class Meta: model = models.News fields = ['news_name', 'news_description', 'news_main_image', 'news_image1', 'news_image2', 'news_image3', 'news_image4', 'news_image5', 'news_url', 'news_published_date', 'news_status'] widgets = { 'news_name': TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Введите название новости', 'id': 'NewsNameInput', }), 'news_description': Textarea(attrs={ 'class': 'form-control', 'id': 'NewsTextInput', 'rows': '5', 'placeholder': 'Введите описание новости', }), 'news_main_image': FileInput(attrs={ 'class': 'upload', 'id': 'NewsMainImage', }), 'news_image1': FileInput(attrs={ 'class': 'upload', 'id': 'NewsImage', }), 'news_image2': FileInput(attrs={ 'class': 'upload', 'id': 'NewsImage1', }), 'news_image3': FileInput(attrs={ 'class': 'upload', 'id': 'NewsImage2', }), 'news_image4': FileInput(attrs={ 'class': 'upload', 'id': 'NewsImage3', }), 'news_image5': FileInput(attrs={ 'class': 'upload', 'id': 'NewsImage4', }), 'news_url': URLInput(attrs={ 'class': 'form-control', 'placeholder': 'Введите ссылку на новость', 'id': 'NewsUrl', }), 'news_published_date': DateInput(format=('%Y-%m-%d'), attrs={ 'type': "date", 'placeholder': "Введите дату публикации", 'class': "form-control", 'id': "NewsPublishedDate", }), }
class Meta: model = Notice fields= '__all__' widgets = { 'title': TextInput(attrs={'class':'form-control', 'placeholder': 'Enter Title ...'}), 'description': Textarea(attrs={'cols': 30, 'rows': 10, 'class':'form-control', 'placeholder': 'Write something about the notice ....'}), 'created_on': DateInput(attrs={'class':'form-control', 'placeholder': 'Select Date'}), 'pdf_file': FileInput(attrs={'class':'form-control', 'placeholder': 'Upload pdf life'}), 'image_url': URLInput(attrs={'class':'form-control'}), }
def __init__(self, *args, **kwargs): super(BitLinkForm, self).__init__(*args, **kwargs) self.fields['link'].widget = URLInput( attrs={ 'id': 'shorten_url', 'class': 'shorten-input', 'name': 'myCustomName', 'placeholder': 'Paste a link to shorten it', 'taborder': '1', 'name': 'url', 'autocomplete': 'off', 'autocorrect': 'off', })
class Meta: model = URLs fields = ['long_url', 'short_url'] widgets = { 'short_url': HiddenInput(), 'long_url': URLInput( attrs={ 'placeholder': 'Paste URL you would like to shorten', 'autofocus': 'autofocus' }) }
class Meta: model = models.Message fields = ['name', 'email', 'url', 'content', 'avatar'] widgets = { 'name': TextInput(attrs={ 'class': "form-control", 'placeholder': "nickname" }), 'email': EmailInput(attrs={ 'class': "form-control", 'placeholder': "*****@*****.**" }), 'url': URLInput(attrs={ 'class': "form-control", 'placeholder': "your blog" }), 'content': Textarea( attrs={ 'class': "form-control", 'placeholder': "留言越屌,bug越少", 'style': "resize:none", 'rows': "5" }), 'avatar': FileInput(attrs={ 'accept': 'image/*', 'onchange': 'verificationPicFile(this)' }) } error_messages = { 'name': { 'required': '用户名不能为空', 'max_length': ("您输入的昵称过长。"), }, 'email': { 'required': '邮箱不能为空', 'max_length': ("您输入的邮箱地址过长。"), 'invalid': '您输入的邮箱格式不正确', }, 'url': { 'max_length': ("您输入的博客地址过长。"), 'invalid': '您输入的URL格式不正确', }, 'content': { 'max_length': ("您输入的评论内容超出限制。"), }, }
class Meta: model = EntityModel fields = [ 'name', 'default_coa', 'activate_all_accounts', 'address_1', 'address_2', 'email', 'website', 'phone' ] labels = { 'name': _('Entity Name'), } widgets = { 'name': TextInput( attrs={ 'class': DJANGO_LEDGER_FORM_INPUT_CLASSES + ' is-large', 'placeholder': _('Entity name...'), 'required': True }), 'address_1': TextInput( attrs={ 'class': DJANGO_LEDGER_FORM_INPUT_CLASSES, 'placeholder': _('Address line 1...') }), 'address_2': TextInput( attrs={ 'class': DJANGO_LEDGER_FORM_INPUT_CLASSES, 'placeholder': _('City, State, ZIP...') }), 'phone': TextInput( attrs={ 'class': DJANGO_LEDGER_FORM_INPUT_CLASSES, 'placeholder': _('Phone number...') }), 'email': EmailInput( attrs={ 'class': DJANGO_LEDGER_FORM_INPUT_CLASSES, 'placeholder': _('Entity email...') }), 'website': URLInput( attrs={ 'class': DJANGO_LEDGER_FORM_INPUT_CLASSES, 'placeholder': _('Entity website...') }), 'default_coa': CheckboxInput(attrs={'class': 'checkbox'}) }
class Meta: model = UserProfile fields = ( "website", "picture", ) widgets = { "website": URLInput(attrs={ "class": "formfield", }), "picture": FileInput(attrs={ "class": "formfield", }), }
class Meta: model = Contact fields = [ 'name', 'last_name', 'big_name', 'text_01', 'birthday', 'num_ber', 'email', 'social' ] widgets = { "name": TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Имя' }), "last_name": TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Фамилия' }), "big_name": TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Отчество' }), "birthday": DateTimeInput(attrs={ 'class': 'form-control', 'placeholder': 'Дата рождения' }), "text_01": Textarea(attrs={ 'class': 'form-control', 'placeholder': 'Описание' }), "num_ber": NumberInput(attrs={ 'class': 'form-control', 'placeholder': 'Номер' }), "email": EmailInput(attrs={ 'class': 'form-control', 'placeholder': 'email' }), "social": URLInput(attrs={ 'class': 'form-control', 'placeholder': 'Соц.сети' }) }
class Meta: model = Contacs fields = [ 'last_name', 'name', 'big_name', 'text', 'birth_day', 'num_ber', 'email', 'social' ] widgets = { "last_name": TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Фамилие' }), "name": TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Имя' }), "big_name": TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Отчество' }), "text": TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Опишите себя' }), "birth_day": DateTimeInput(attrs={ 'class': 'form-control', 'placeholder': 'Дата публикации' }), "num_ber": NumberInput(attrs={ 'class': 'form-control', 'placeholder': 'Номер телефона' }), "email": EmailInput(attrs={ 'class': 'form-control', 'placeholder': 'email' }), "social": URLInput(attrs={ 'class': 'form-control', 'placeholder': 'Соц. сеть' }), }
class Meta: model = UserProfile fields = [ "fullname", "email", "type", "title", "primary_group", "phone", "bio", "photo_url", "campus", "building", "room" ] widgets = { "type": TextInput(), "title": TextInput(), "phone": TextInput(), "photo_url": URLInput(), "campus": TextInput(), "building": TextInput(), "room": TextInput() }
class AddMaterial(Form): title = CharField(widget=TextInput({ 'class': 'form-control', 'placeholder': 'Введите название Материала', 'id': 'title', })) units = ChoiceField(widget=Select({ 'class': 'form-control', }), choices=[[x] * 2 for x in UNITS], label="Единицы измерения") url = URLField(widget=URLInput({'class': 'form-control'}), label="URL изображения", required=False)