class Meta: model = VoucherRequisition fields = ( 'file', 'status', 'response', ) exclude = [ 'employee', 'type', 'date_start', 'date_end', 'reason', 'created_by', 'created_date', 'updated_by', 'updated_date', ] widgets = { 'file': FileInput( attrs={ 'class': 'filestyle', 'data-iconName': 'glyphicon glyphicon-file', 'data-buttonText': 'Seleccionar Archivo' }), 'status': Select(attrs={'class': 'form-control'}), 'response': Textarea(attrs={ 'class': 'form-control', 'rows': '8' }), } labels = { 'file': 'Archivo', 'status': 'Estado', 'response': 'Respuesta', }
class Meta: model = Request fields = ('title', 'description', 'ref_pic', 'min_price', 'max_price') widgets = { 'title': TextInput(attrs={ 'class': 'form-control', 'placeholder': 'What do you need?' }), 'description': TextInput( attrs={ 'class': 'form-control', 'placeholder': "Describe what you're looking for" }), 'min_price': NumberInput(attrs={'class': 'form-control'}), 'max_price': NumberInput(attrs={'class': 'form-control'}), 'ref_pic': FileInput(), }
class Meta: model = Evidence fields = [ 'title', 'reference', 'comment', 'bag_number', 'location', 'uri', 'current_status', 'qr_code_text', 'qr_code', 'retention_reminder_sent', 'slug', 'type', 'status', 'classification', 'priority', 'authorisation', 'category', 'chain_of_custody', 'assigned_to', 'custodian', 'assigned_by' ] labels = { 'type': _('Evidence Type'), 'title': _('Title'), 'reference': _('Reference'), 'background': _('Background'), 'location': _('Location'), 'description': _('Description'), 'brief': _('Brief'), } error_messages = { 'evidence': { 'max_length': _("The Evidence Type is Invalid"), }, } help_texts = { 'title': _('Some useful help text.'), } widgets = { 'authorisation': Select(attrs={'class': 'form-control'}), 'priority': Select(attrs={'class': 'form-control'}), 'classification': Select(attrs={'class': 'form-control'}), 'status': Select(attrs={'class': 'form-control'}), 'type': Select(attrs={'class': 'form-control'}), 'assigned_by': Select(attrs={'class': 'form-control'}), 'assigned_to': Select(attrs={'class': 'form-control'}), 'manager': Select(attrs={'class': 'form-control'}), 'image_upload': FileInput(attrs={'class': 'form-control'}), #'title': CharField(attrs={'max_length': 200, 'required': False}), }
class Meta: model = Serie exclude = {'id'} widgets = { 'name': TextInput(attrs={'class': 'form-control'}), 'chapters': TextInput(attrs={'class': 'form-control'}), 'descripcion': Textarea(attrs={ 'class': 'form-control', 'rows': '3' }), 'gender': TextInput(attrs={'class': 'form-control'}), 'status': Select(attrs={'class': 'form-control'}), 'rank': Select(attrs={'class': 'form-control'}), 'image': FileInput(attrs={ 'class': 'form-control', 'placeholder': 'seleccione una imagen' }), 'code': TextInput(attrs={'class': 'form-control'}), 'in_disk': Select(attrs={'class': 'form-control'}), 'complete': Select(attrs={'class': 'form-control'}), 'ubication': TextInput(attrs={'class': 'form-control'}), 'observations': Textarea(attrs={ 'class': 'form-control', 'rows': '3' }), }
class Meta: model = Patients #fields = ['name','dt_birthday', 'rg', 'rg_exped', 'rg_uf','cpf', 'name_mother', 'name_father', 'sex', 'uf_natural', 'origin', 'schooling','maritalstatus', 'religion', 'situation_inss', 'scort', 'email'] fields = '__all__' widgets = { 'name': TextInput(attrs={'class': 'form-control'}), 'dt_birthday': DateTimeInput(format='%d/%m/%Y %H:%M', attrs={'class': 'form-control calendario'}), 'rg': TextInput(attrs={'class': 'form-control','onkeypress':'return somenteNumeros(event)'}), 'rg_exped': TextInput(attrs={'class': 'form-control'}), 'rg_uf': Select(attrs={'class': 'form-control'}), 'cpf': TextInput(attrs={'class': 'form-control cpf', 'onkeypress':'return somenteNumeros(event)'}), 'name_mother': TextInput(attrs={'class': 'form-control'}), 'name_father': TextInput(attrs={'class': 'form-control'}), 'sex': Select(attrs={'class': 'form-control'}), 'uf_natural': TextInput(attrs={'class': 'form-control cidade_estado'}), 'origin': Select(attrs={'class': 'form-control'}), 'schooling': Select(attrs={'class': 'form-control'}), 'maritalstatus': Select(attrs={'class': 'form-control'}), 'religion': Select(attrs={'class': 'form-control'}), 'situation_inss': Select(attrs={'class': 'form-control'}), 'scort': TextInput(attrs={'class': 'form-control'}), 'scort_type': Select(attrs={'class': 'form-control'}), 'email': TextInput(attrs={'class': 'form-control'}), 'blood_type': Select(attrs={'class': 'form-control'}), 'blood_rh': Select(attrs={'class': 'form-control'}), 'address': TextInput(attrs={'class': 'form-control'}), 'address_num': TextInput(attrs={'class': 'form-control','onkeypress':'return somenteNumeros(event)'}), 'address_city_uf': TextInput(attrs={'class': 'form-control cidade_estado'}), 'cep': TextInput(attrs={'class': 'form-control cep', 'onkeypress':'return somenteNumeros(event)'}), 'phone': TextInput(attrs={'class': 'form-control phone'}), 'user': HiddenInput(attrs={'class': 'form-control'}), 'avatar': FileInput(attrs={'class': 'form-control'}), } error_messages = { 'name': { 'blank': _("Não pode ser em branco."), }, }
class CreateAwardsForm(ModelForm): statuschoice = ( (True, 'Active'), (False, 'Not Active'), ) # title = CharField( # max_length=225, # error_messages={'required': 'Title can not be empty', 'placeholder': "input title"}, # widget=TextInput(attrs={'class': "form-control", 'placeholder': "input title"}), # ) # description = CharField( # required=False, # widget=Textarea(attrs={'class': 'form-control', 'placeholder': "input physical location description"}), # ) image = FileField( widget=FileInput(attrs={ 'class': 'form-control', 'id': 'img_input' }), required=True, error_messages={'required': 'image can not be empty'}, ) # position = IntegerField( # error_messages={'placeholder': "input position"}, # widget=TextInput(attrs={'class': "form-control", 'placeholder': "input position"}), # ) status = ChoiceField( error_messages={'required': 'status can not be empty'}, widget=RadioSelect(attrs={'class': "Radio"}), choices=statuschoice, initial=True) class Meta: model = AwardsGalery fields = ('title', 'description', 'image', 'position', 'status')
class Meta: model = Person fields = '__all__' widgets = { 'name': TextInput(attrs={'class': 'form-control'}), 'dt_birthday': DateInput(format='%d/%m/%Y', attrs={'class': 'form-control calendario'}), 'cpf': TextInput(attrs={'class': 'form-control cpf','onkeypress':'return somenteNumeros(event)'}), 'sex': Select(attrs={'class': 'form-control'}), 'uf_natural': TextInput(attrs={'class': 'form-control cidade_estado'}), 'maritalstatus': Select(attrs={'class': 'form-control'}), 'rg': TextInput(attrs={'class': 'form-control','onkeypress':'return somenteNumeros(event)'}), 'rg_exped': TextInput(attrs={'class': 'form-control'}), 'rg_uf': Select(attrs={'class': 'form-control'}), 'pis_pasep': TextInput(attrs={'class': 'form-control ','onkeypress':'return somenteNumeros(event)'}), 'voter_title_num': TextInput(attrs={'class': 'form-control','onkeypress':'return somenteNumeros(event)'}), 'voter_title_section': TextInput(attrs={'class': 'form-control','onkeypress':'return somenteNumeros(event)'}), 'voter_title_zone': TextInput(attrs={'class': 'form-control','onkeypress':'return somenteNumeros(event)'}), 'voter_title_uf': Select(attrs={'class': 'form-control'}), 'cnh_num': TextInput(attrs={'class': 'form-control','onkeypress':'return somenteNumeros(event)'}), 'cnh_uf': Select(attrs={'class': 'form-control'}), 'cnh_validate': DateInput(format='%d/%m/%Y', attrs={'class': 'form-control calendario'}), 'cnh_category': Select(attrs={'class': 'form-control'}), 'address': TextInput(attrs={'class': 'form-control'}), 'address_num': TextInput(attrs={'class': 'form-control','onkeypress':'return somenteNumeros(event)'}), 'address_city_uf': TextInput(attrs={'class': 'form-control cidade_estado'}), 'cep': TextInput(attrs={'class': 'form-control cep','onkeypress':'return somenteNumeros(event)'}), 'email': EmailInput(attrs={'class': 'form-control'}), 'phone': TextInput(attrs={'class': 'form-control phone','onkeypress':'return somenteNumeros(event)'}), 'user_created': HiddenInput(attrs={'class': 'form-control'}), 'user_updated': HiddenInput(attrs={'class': 'form-control'}), 'avatar': FileInput(attrs={'class': 'form-control'}), #SO, IP e BROWSER serão direto na view } error_messages = { 'name': { 'blank': ("Não pode ser em branco."), }, }
class ProfilImageUpdateForm(forms.ModelForm): class Meta: model = UserProfile fields = ('profile_image', ) profile_image = forms.ImageField(label='Image de Profil', required=False, error_messages ={'invalid': "Importer uniquement un fichier .png ou .jpg"}, widget=FileInput(attrs={'class': 'custom-file-input', '@change': 'previewImage'})) remove_profile_image = forms.BooleanField(label="Supprimer l'avatar", required=False, widget=CheckboxInput(attrs={'class': 'custom-control-input'})) def save(self, commit=False, *args, **kwargs): user_profile = super().save(commit=False, *args, **kwargs) if self.cleaned_data['remove_profile_image']: default_image = user_profile._meta.get_field('profile_image').get_default() user_profile.profile_image = default_image user_profile.save() else: user_profile.profile_image = self.cleaned_data['profile_image'] user_profile.save() return user_profile
def cover_view(request): formset = inlineformset_factory( User, CoverPictureModel, fields=['name', 'path'], can_delete=False, exclude=['delete'], extra=1, widgets={'path': FileInput({'accept': '.jpg'})}) if request.method == 'POST': userObj = User.objects.get(username=request.user) form = formset(request.POST, request.FILES, instance=userObj) if userObj is not None and form.is_valid() is True: form.save() messages.add_message(request, messages.SUCCESS, 'Upload Success.') return redirect(to='cover') for error in form.errors: messages.add_message(request, messages.WARNING, error) return redirect(to='cover') context = {"form": formset, "pictures": CoverPictureModel.objects.all()} return render(request, "home/cover.html", context)
class Meta: model = KerberosRepository fields = ('name', 'realm', 'domain_realm', 'kdc', 'admin_server', 'krb5_service', 'keytab') widgets = { 'name': TextInput(attrs={'class': 'form-control'}), 'realm': TextInput(attrs={'class': 'form-control'}), 'domain_realm': TextInput(attrs={'class': 'form-control'}), 'kdc': TextInput(attrs={ 'class': 'form-control', 'data-role': "tagsinput" }), 'admin_server': TextInput(attrs={'class': 'form-control'}), 'krb5_service': TextInput(attrs={'class': 'form-control'}), 'keytab': FileInput(attrs={'class': 'form-control'}), }
class ReviewForm(forms.ModelForm): '''Form for add reviews from noodle page''' # We manually add a field to this class based form- I do not know if # this was actually better image = forms.ImageField( required=False, widget=FileInput(attrs={'class': 'form-control-file'})) class Meta: model = Review fields = ["title", "body", "rating"] # This is how you override widgets for class-based forms widgets = { 'title': TextInput(attrs={'class': 'form-control'}), 'rating': Select(attrs={'class': 'form-control'}), 'body': Textarea(attrs={ 'class': 'form-control', 'cols': 40, 'rows': 10 }), }
class Meta: model = Event fields = [ "title", "date_time", "description", "cover_photo", "genre", ] widgets = { # 'date_time': DateTimeInput(attrs={"placeholder": "MM/DD/YYYY HH:MM"}), 'description': Textarea(attrs={ "placeholder": gettext_lazy("Tell everyone about your concert!") }), 'cover_photo': FileInput(attrs={}) } labels = { "date_time": "Date and time:", "description": "", "title": "Title", }
class Meta: model = empresas fields = [ 'barrio', 'direccion', 'email', 'telefono', 'ica', 'observaciones', 'fotos' ] widgets = { 'barrio': Select(attrs={'class': 'form-control'}), 'direccion': TextInput(attrs={'class': 'form-control'}), 'email': EmailInput(attrs={'class': 'form-control'}), 'telefono': NumberInput(attrs={'class': 'form-control'}), 'ica': CheckboxInput(attrs={'class': 'form-control'}), 'observaciones': TextInput(attrs={'class': 'form-control'}), 'fotos': FileInput(attrs={'class': 'form-control'}), } labels = { 'barrio': 'Barrio', 'direccion': 'Dirección', 'email': 'Correo electrónico', 'telefono': 'Teléfono', 'ica': 'Inscrito ICA', 'observaciones': 'Observaciones', 'fotos': 'Imagen del lugar', }
class Meta: model = Profile exclude = ['user'] help_texts = { 'image': "We recommend you use a square image for best results." } widgets = { 'bio': Textarea(attrs={ 'class': "form-control w-75", 'style': "height:100px;" }), 'location': Select(attrs={'class': "form-control w-75"}), 'birthdate': DateInput(attrs={ 'type': 'date', 'class': 'form-control w-75' }), 'image': FileInput(attrs={'class': "form-control-file w-75"}), 'sex': Select(attrs={'class': 'form-control w-25'}) }
class Meta: model = Career widgets = { 'profile_type': Select(attrs={'class': 'form-control'}), 'name': TextInput(attrs={ 'placeholder': 'Your Name', 'class': 'form-control', 'id': 'name' }), 'mobile': TextInput( attrs={ 'placeholder': 'Mobile Number', 'class': 'form-control', 'id': 'mobile', 'type': 'number', 'min': 5000000000, 'max': 9999999999, }), 'email': EmailInput( attrs={ 'placeholder': 'Email', 'class': 'form-control', 'id': 'email', 'pattern': "[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$", 'oninvalid': "setCustomValidity('Enter a Valid Email Address')", 'oninput': "setCustomValidity('')" }), 'resume': FileInput(attrs={'id': 'upload-resume'}), } fields = ['profile_type', 'name', 'mobile', 'email', 'resume']
class Meta: model = UserProfile fields = ('ogrencino', 'phone', 'address', 'city', 'country', 'image') widgets = { 'ogrencino': TextInput(attrs={ 'class': 'form-control', 'placeholder': 'ogrencino' }), 'phone': TextInput(attrs={ 'class': 'form-control', 'placeholder': 'phone' }), 'address': TextInput(attrs={ 'class': 'form-control', 'placeholder': 'address' }), 'city': Select(attrs={ 'class': 'form-control', 'placeholder': 'city' }, choices=CITY), 'country': TextInput(attrs={ 'class': 'form-control', 'placeholder': 'country' }), 'image': FileInput(attrs={ 'class': 'form-control', 'placeholder': 'image' }), }
class WorkshopPageForm(ModelForm): qualification_problems = FileField(required=False, widget=FileInput()) class Meta: model = Workshop fields = [ 'qualification_problems', 'is_qualifying', 'page_content_is_public', 'qualification_threshold', 'page_content' ] widgets = { 'page_content': RichTextarea(), } labels = { 'qualification_problems': u'Zadania kwalifikacyjne w PDF:', 'is_qualifying': u'Czy warsztaty są kwalifikujące (odznacz, jeśli nie zamierzasz dodawać zadań i robić kwalifikacji)', 'page_content': u'Strona warsztatów', 'page_content_is_public': u'Zaznacz, jeśli opis jest gotowy i może już być publiczny.', 'qualification_threshold': u'Minimalna liczba punktów potrzeba do kwalifikacji (wpisz dopiero po sprawdzeniu zadań)' }
class Meta: model = UserProfile fields = ( 'phone', 'address', 'city', 'country', 'image', ) widgets = { 'phone': TextInput(attrs={ 'class': 'input', 'placeholder': 'phone' }), 'address': TextInput(attrs={ 'class': 'input', 'placeholder': 'address' }), 'city': TextInput(attrs={ 'class': 'input', 'placeholder': 'city' }, ), 'country': TextInput(attrs={ 'class': 'input', 'placeholder': 'country' }), 'image': FileInput(attrs={ 'class': 'input', 'placeholder': 'image', }), }
class Meta: model = models.AboutCinema fields = ['cinema_name', 'cinema_description', 'cinema_main_image', 'cinema_image1', 'cinema_image2', 'cinema_image3', 'cinema_image4', 'cinema_image5', 'status'] widgets = { 'cinema_name': TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Введите название сети кинотеатров', 'id': 'AboutNameInput', }), 'cinema_description': Textarea(attrs={ 'class': 'form-control', 'id': 'AboutTextInput', 'rows': '5', 'placeholder': 'Введите описание сети кинотеатров', }), 'cinema_main_image': FileInput(attrs={ 'class': 'upload', 'id': 'AboutMainImage', }), 'cinema_image1': FileInput(attrs={ 'class': 'upload', 'id': 'AboutMainImage1', }), 'cinema_image2': FileInput(attrs={ 'class': 'upload', 'id': 'AboutMainImage2', }), 'cinema_image3': FileInput(attrs={ 'class': 'upload', 'id': 'AboutMainImage3', }), 'cinema_image4': FileInput(attrs={ 'class': 'upload', 'id': 'AboutMainImage4', }), 'cinema_image5': FileInput(attrs={ 'class': 'upload', 'id': 'AboutMainImage5', }), }
class Meta: model = models.CafeBar fields = ['cafebar_name', 'cafebar_description', 'cafebar_main_image', 'cafebar_image1', 'cafebar_image2', 'cafebar_image3', 'cafebar_image4', 'cafebar_image5', 'status'] widgets = { 'cafebar_name': TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Введите название кафе-бара', 'id': 'CafeBarNameInput', }), 'cafebar_description': Textarea(attrs={ 'class': 'form-control', 'id': 'CafeBarTextInput', 'rows': '5', 'placeholder': 'Введите описание кафе-бара', }), 'cafebar_main_image': FileInput(attrs={ 'class': 'upload', 'id': 'CafeBarMainImage', }), 'cafebar_image1': FileInput(attrs={ 'class': 'upload', 'id': 'Image1', }), 'cafebar_image2': FileInput(attrs={ 'class': 'upload', 'id': 'Image2', }), 'cafebar_image3': FileInput(attrs={ 'class': 'upload', 'id': 'Image3', }), 'cafebar_image4': FileInput(attrs={ 'class': 'upload', 'id': 'Image4', }), 'cafebar_image5': FileInput(attrs={ 'class': 'upload', 'id': 'Image5', }), }
class Meta: model = models.VipHall fields = ['hall_name', 'hall_description', 'hall_main_image', 'hall_image1', 'hall_image2', 'hall_image3', 'hall_image4', 'hall_image5', 'status'] widgets = { 'hall_name': TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Введите название VIP-зала', 'id': 'VipHallNameInput', }), 'hall_description': Textarea(attrs={ 'class': 'form-control', 'id': 'VipHallTextInput', 'rows': '5', 'placeholder': 'Введите описание VIP-зала', }), 'hall_main_image': FileInput(attrs={ 'class': 'upload', 'id': 'VipHallMainImage', }), 'hall_image1': FileInput(attrs={ 'class': 'upload', 'id': 'Image1', }), 'hall_image2': FileInput(attrs={ 'class': 'upload', 'id': 'Image2', }), 'hall_image3': FileInput(attrs={ 'class': 'upload', 'id': 'Image3', }), 'hall_image4': FileInput(attrs={ 'class': 'upload', 'id': 'Image4', }), 'hall_image5': FileInput(attrs={ 'class': 'upload', 'id': 'Image5', }), }
class Meta: model = models.ChildRoom fields = ['room_name', 'room_description', 'room_main_image', 'room_image1', 'room_image2', 'room_image3', 'room_image4', 'room_image5', 'status'] widgets = { 'room_name': TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Введите название детской комнаты', 'id': 'RoomNameInput', }), 'room_description': Textarea(attrs={ 'class': 'form-control', 'id': 'RoomTextInput', 'rows': '5', 'placeholder': 'Введите описание детской комнаты', }), 'room_main_image': FileInput(attrs={ 'class': 'upload', 'id': 'RoomMainImage', }), 'room_image1': FileInput(attrs={ 'class': 'upload', 'id': 'Image1', }), 'room_image2': FileInput(attrs={ 'class': 'upload', 'id': 'Image2', }), 'room_image3': FileInput(attrs={ 'class': 'upload', 'id': 'Image3', }), 'room_image4': FileInput(attrs={ 'class': 'upload', 'id': 'Image4', }), 'room_image5': FileInput(attrs={ 'class': 'upload', 'id': 'Image5', }), }
class Meta: model = models.Advertising fields = ['adv_name', 'adv_description', 'adv_main_image', 'adv_image1', 'adv_image2', 'adv_image3', 'adv_image4', 'adv_image5', 'status'] widgets = { 'adv_name': TextInput(attrs={ 'class': 'form-control', 'placeholder': 'Введите название рекламы', 'id': 'AdvNameInput', }), 'adv_description': Textarea(attrs={ 'class': 'form-control', 'id': 'AdvTextInput', 'rows': '5', 'placeholder': 'Введите описание рекламы', }), 'adv_main_image': FileInput(attrs={ 'class': 'upload', 'id': 'AdvMainImage', }), 'adv_image1': FileInput(attrs={ 'class': 'upload', 'id': 'Image1', }), 'adv_image2': FileInput(attrs={ 'class': 'upload', 'id': 'Image2', }), 'adv_image3': FileInput(attrs={ 'class': 'upload', 'id': 'Image3', }), 'adv_image4': FileInput(attrs={ 'class': 'upload', 'id': 'Image4', }), 'adv_image5': FileInput(attrs={ 'class': 'upload', 'id': 'Image5', }), }