Ejemplo n.º 1
0
 class Meta:
     model = CompanyInfo
     exclude = ['company_id','company_starttime','company_updatetime']
     widgets = {
                'company_src_name': TextInput(attrs={'class':'form-control','placeholder':'XX安全中心'}),
                'company_src_www': URLInput(attrs={'class':'form-control','placeholder':'https://xxxx.xx'}),
                'company_name': TextInput(attrs={'class':'form-control','placeholder':'XX公司'}),
                'company_www': URLInput(attrs={'class':'form-control','placeholder':'https://xxxx.xx'}),
                'company_ioc': TextInput(attrs={'class':'form-control','placeholder':'https://xxxx.xx/xx.png'}),
                }
Ejemplo n.º 2
0
class EnterTaskForm(forms.Form):
    ''' Форма для ввода задания '''
    url = forms.URLField(
        label='URL',
        help_text='Ссылка на раздел сайта www.olx.ua',
        widget=URLInput(attrs={'class': 'form-control'}),
        validators=[
            validators.RegexValidator(
                r'^https://www.olx.ua/[a-z\-]{1,}/[a-z\-]{1,}/')
        ],
        error_messages={
            'invalid':
            'Нужно указать ссылку на существующий раздел сайта olx.ua!'
        })

    email = forms.EmailField(
        label='E-mail',
        help_text='Ваш E-mail, на который будет выслана ссылка с отчетом',
        widget=EmailInput(attrs={'class': 'form-control'}))

    description = forms.CharField(
        max_length=250,
        label='Описание',
        help_text='Это описание будет использовано в заголовке отчёта',
        widget=TextInput(attrs={'class': 'form-control'}))
Ejemplo n.º 3
0
 class Meta:
     model = Subdomain
     exclude = ['subdomain_company','subdomain_starttime','subdomain_updatetime','subdomain_id']
     widgets = {
                'subdomain_name': TextInput(attrs={'class':'form-control','placeholder':'子域名名称'}),
                'subdomain_www': URLInput(attrs={'class':'form-control','placeholder':'https://xxxx.xx'}),
                }
Ejemplo n.º 4
0
 class Meta:
     model = Listing
     fields = [
         'title', 'description', 'imageLink', 'category', 'startingPrice'
     ]
     labels = {
         "title": "",
         "description": "",
         "imageLink": "",
         "startingPrice": ""
     }
     widgets = {
         'title':
         TextInput(attrs={
             'placeholder': 'Title',
             'id': 'listingFormTitle'
         }),
         'description':
         Textarea(
             attrs={
                 'placeholder': 'Type the auction description here',
                 'id': 'listingFormDescription'
             }),
         'imageLink':
         URLInput(attrs={
             'placeholder': 'Image URL Link',
             'id': 'listingFormImageLink'
         }),
         'startingPrice':
         NumberInput(attrs={
             'placeholder': 'Starting Price',
             'id': 'listingFormStartingPrice'
         }),
     }
Ejemplo n.º 5
0
    def get_form_field_instances(self,
                                 request=None,
                                 form_entry=None,
                                 form_element_entries=None,
                                 **kwargs):
        """Get form field instances."""
        widget_attrs = {
            'class': theme.form_element_html_class,
            'type': 'url',
            'placeholder': self.data.placeholder,
        }

        field_kwargs = {
            'label': self.data.label,
            'help_text': self.data.help_text,
            'initial': self.data.initial,
            'required': self.data.required,
            'widget': URLInput(attrs=widget_attrs),
        }

        if self.data.max_length:
            try:
                field_kwargs['max_length'] = int(self.data.max_length)
            except ValueError:
                field_kwargs['max_length'] = None
        else:
            field_kwargs['max_length'] = None

        field_kwargs['min_length'] = None

        return [(self.data.name, URLField, field_kwargs)]
Ejemplo n.º 6
0
    class Meta:
        model = TrainingDocument
        fields = ['name', 'document_url']

        widgets = {
            'name': TextInput(attrs={'placeHolder': 'Döküman adı'}),
            'document_url': URLInput(attrs={'placeHolder': 'Döküman URLi'})
        }
Ejemplo n.º 7
0
 class Meta:
     model = Webinfo
     exclude = ['web_subdomain','web_id','web_starttime','web_updatetime']
     widgets = {
                'web_url': URLInput(attrs={'class':'form-control','placeholder':'网页链接'}),
                'web_front': TextInput(attrs={'class':'form-control','placeholder':'前端语言'}),
                'web_language': TextInput(attrs={'class':'form-control','placeholder':'开发语言'}),
                'web_framework': TextInput(attrs={'class':'form-control','placeholder':'开发框架'}),
                'web_template': TextInput(attrs={'class':'form-control','placeholder':'网站模板'}),
                'web_container': TextInput(attrs={'class':'form-control','placeholder':'WEB容器'}),
                }
Ejemplo n.º 8
0
 class Meta:
     model = Tips
     fields = ('tips', 'tag', 'url')
     widgets = {
         'tips': Textarea(
             attrs={'autocomplete': 'off', 'autofocus': 'autofocus', 'onscroll': 'this.rows++;', 'placeholder': _('Tips')}
         ),
         'tag': TextInput(
             attrs={'autocomplete': 'off', 'placeholder': _('Tags')}
         ),
         'url': URLInput(attrs={'autocomplete': 'off', 'placeholder': _('Url')}),
     }
Ejemplo n.º 9
0
 class Meta:
     model = ApiInfo
     fields = ('api', 'func', 'tag', 'url')
     widgets = {
         'api': TextInput(
             attrs={'autocomplete': 'off', 'autofocus': 'autofocus', 'placeholder': _('Api')}
         ),
         'func': Textarea(
             attrs={'autocomplete': 'off', 'onscroll': 'this.rows++;', 'placeholder': _('Func')}
         ),
         'tag': TextInput(
             attrs={'autocomplete': 'off', 'placeholder': _('Tags')}
         ),
         'url': URLInput(attrs={'autocomplete': 'off', 'placeholder': _('Url')}),
     }
Ejemplo n.º 10
0
 class Meta:
     model = UserInfo
     exclude = ('password', 'status')
     widgets = {
         'username': TextInput(
             attrs={'autocomplete': 'off', 'autofocus': 'autofocus', 'readonly': 'true', 'placeholder': _('Username')}
         ),
         'login_page': URLInput(
             attrs={'autocomplete': 'off', 'placeholder': _('Login Page')}
         ),
         'display_bg': CheckboxInput(
             attrs={'autocomplete': 'off', 'placeholder': _('Display Background')}
         ),
         'classify': Select(
             attrs={'autocomplete': 'off', 'placeholder': _('Background Classify')}
         ),
         'search_engine': Select(
             attrs={'autocomplete': 'off', 'placeholder': _('Search Engine')}
         ),
         'email': TextInput(
             attrs={'autocomplete': 'off', 'placeholder': _('Email')}
         ),
         'company': TextInput(
             attrs={'autocomplete': 'off', 'placeholder': _('Company')}
         ),
         'github': TextInput(
             attrs={'autocomplete': 'off', 'placeholder': _('Github')}
         ),
         'sof': TextInput(
             attrs={'autocomplete': 'off', 'placeholder': _('Stackoverflow')}
         ),
         'weibo': TextInput(
             attrs={'autocomplete': 'off', 'placeholder': _('Weibo')}
         ),
         'rren': TextInput(
             attrs={'autocomplete': 'off', 'placeholder': _('RRen')}
         ),
         'v2ex': TextInput(
             attrs={'autocomplete': 'off', 'placeholder': _('V2EX')}
         ),
         'blog': TextInput(
             attrs={'autocomplete': 'off', 'placeholder': _('Blog')}
         ),
         'btc': TextInput(
             attrs={'autocomplete': 'off', 'placeholder': _('BTC')}
         ),
     }
Ejemplo n.º 11
0
class UpdateProfileForm(ModelForm):
    input_field_class = 'bg-gray-700 bg-opacity-0 ml-2 pb-1 outline-none text-white placeholder-gray-600'

    profile_image = ImageField(label='',
                               widget=FileInput(attrs={
                                   'class': 'hidden',
                                   'accept': '.jpg,.png'
                               }))

    background_image = ImageField(widget=FileInput(attrs={
        'class': 'hidden',
        'accept': '.jpg,.png'
    }))

    bio = CharField(required=False,
                    widget=Textarea(
                        attrs={
                            'class': input_field_class + ' resize-none',
                            'placeholder': 'Add your bio',
                            'rows': 3
                        }))

    location = CharField(
        required=False,
        widget=TextInput(attrs={
            'class': input_field_class,
            'placeholder': 'Add your location'
        }))

    website = URLField(
        required=False,
        max_length=100,
        widget=URLInput(attrs={
            'class': input_field_class,
            'placeholder': 'Add your website'
        }))

    class Meta:
        model = Profile
        fields = [
            'profile_image', 'background_image', 'bio', 'location', 'website'
        ]

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
Ejemplo n.º 12
0
 class Meta:
     model = EDM
     fields = ('title', 'cover_image', 'cover_hype_link',
               'cover_description', 'selection_articles', 'publish_time')
     widgets = {
         'publish_time': DateTimeInput(attrs={'class': 'form-control'}),
         'cover_description': Textarea(attrs={'class': 'form-control'}),
         'selection_articles':
         SelectMultiple(attrs={'class': 'chosen-select'}),
         'title': TextInput(attrs={'class': 'form-control'}),
         'cover_hype_link': URLInput(attrs={'class': 'form-control'})
     }
     labels = {
         'title': _('title'),
         'cover_image': _('cover image'),
         'cover_hype_link': _('cover hype link'),
         'cover_description': _('cover description'),
         'selection_articles': _('selection articles'),
         'publish_time': _('publish time')
     }
Ejemplo n.º 13
0
    def get_form_field_instances(self, request=None):
        """
        Get form field instances.
        """
        widget_attrs = {
            'class': theme.form_element_html_class,
            'type': 'url',
            'placeholder': self.data.placeholder,
        }

        kwargs = {
            'label': self.data.label,
            'help_text': self.data.help_text,
            'initial': self.data.initial,
            'required': self.data.required,
            'widget': URLInput(attrs=widget_attrs),
        }
        if self.data.max_length:
            kwargs['max_length'] = self.data.max_length

        return [(self.data.name, URLField, kwargs)]
Ejemplo n.º 14
0
    class Meta:
        model = Apply
        exclude = (
            "id",
            "createtime",
            "finishtime",
            "updatetime",
            "status",
            "order_user",
            "product",
            "description",
            "report_file",
            "feedback",
        )

        widgets = {
            'report_address':
            URLInput(attrs={
                'class': 'form-control',
                'style': 'width:450px;'
            }),
        }
Ejemplo n.º 15
0
class ProfileEditForm(forms.ModelForm):
    class Meta:
        model = UserProfile
        fields = (
            'github',
            'telegram',
            'linked_in',
            'vk',
            'bio',
            'skills',
        )

    github = forms.URLField(
        required=False,
        max_length=UserProfile._meta.get_field('github').max_length,
        widget=URLInput(
            attrs={
                'placeholder': "Ссылка на ваш профиль",
                'id': 'github',
                'name': 'github',
                'class': 'form-control form-control-alternative',
                'onchange': "checkURL(this)",
            }))

    telegram = forms.URLField(
        required=False,
        max_length=UserProfile._meta.get_field('telegram').max_length,
        widget=URLInput(
            attrs={
                'placeholder': "Ссылка на ваш профиль",
                'id': 'telegram',
                'name': 'telegram',
                'class': 'form-control form-control-alternative',
                'onchange': "checkURL(this)",
            }))

    linked_in = forms.URLField(
        required=False,
        max_length=UserProfile._meta.get_field('linked_in').max_length,
        widget=URLInput(
            attrs={
                'placeholder': "Ссылка на ваш профиль",
                'id': 'linked_in',
                'name': 'linked_in',
                'class': 'form-control form-control-alternative',
                'onchange': "checkURL(this)",
            }))

    vk = forms.URLField(
        required=False,
        max_length=UserProfile._meta.get_field('vk').max_length,
        widget=URLInput(
            attrs={
                'placeholder': "Ссылка на ваш профиль",
                'id': 'vk',
                'name': 'vk',
                'class': 'form-control form-control-alternative',
                'onchange': "checkURL(this)",
            }))

    bio = forms.CharField(
        required=False,
        max_length=UserProfile._meta.get_field('bio').max_length,
        widget=forms.Textarea(
            attrs={
                'placeholder':
                "Любые детали такие как возраст, страна или город.",
                "rows": "4",
                'id': 'bio',
                "maxlength": UserProfile._meta.get_field('bio').max_length,
                'name': 'bio',
                'class': 'form-control form-control-alternative'
            }))

    skills = TagField(min_length=2,
                      required=False,
                      widget=forms.TextInput(attrs={
                          'data-role': 'tagsinput',
                          'name': 'skills',
                      }, ))
Ejemplo n.º 16
0
class ProjectForm(forms.ModelForm):
    name = forms.CharField(
        required=True,
        max_length=Project._meta.get_field('name').max_length,
        widget=TextInput(
            attrs={
                'class': 'form-control',
                'placeholder': 'Название',
                'label': 'name',
                'name': 'name'
            }))

    description = forms.CharField(
        required=False,
        max_length=Project._meta.get_field('description').max_length,
        widget=forms.Textarea(
            attrs={
                'placeholder': "Подробно опишите идею Вашего проекта",
                "rows": "4",
                'id': 'description',
                "maxlength": Project._meta.get_field('description').max_length,
                'name': 'description',
                'class': 'form-control form-control-alternative'
            }))

    max_people = forms.IntegerField(
        required=False,
        max_value=10,
        widget=forms.NumberInput(
            attrs={
                'class': 'form-control',
                'placeholder': 'Максимальное количество участников',
                'label': 'max_people',
                'min': 0,
                'max': 10,
                'name': 'max_people',
                'value': 0,
            }))

    technical_spec_url = forms.URLField(
        required=False,
        max_length=Project._meta.get_field('technical_spec_url').max_length,
        widget=URLInput(
            attrs={
                'placeholder': "Ссылка на ТЗ (если есть)",
                'id': 'technical_spec_url',
                'name': 'technical_spec_url',
                'class': 'form-control form-control-alternative',
            }))

    is_public = forms.CharField(label='Тип проекта',
                                widget=forms.Select(attrs={
                                    'class': 'selectpicker',
                                    'id': 'type',
                                    'name': 'type'
                                },
                                                    choices=[(1, 'Открытый'),
                                                             (0, 'Приватный')
                                                             ]))

    trello = forms.URLField(
        required=False,
        max_length=Project._meta.get_field('trello').max_length,
        widget=URLInput(
            attrs={
                'placeholder': "Ссылка на Kanban (Trello)",
                'id': 'trello',
                'name': 'trello',
                'class': 'form-control form-control-alternative',
            }))

    vcs = forms.URLField(
        required=False,
        max_length=Project._meta.get_field('vcs').max_length,
        widget=URLInput(
            attrs={
                'placeholder': "Ссылка на VCS",
                'id': 'vcs',
                'name': 'vcs',
                'class': 'form-control form-control-alternative',
            }))

    callback = forms.URLField(
        required=False,
        max_length=Project._meta.get_field('callback').max_length,
        widget=URLInput(
            attrs={
                'placeholder': "Связь и общение (Telegram, Discord, Slack)",
                'id': 'callback',
                'name': 'callback',
                'class': 'form-control form-control-alternative',
            }))

    tags = TagField(widget=forms.TextInput(attrs={
        'data-role': 'tagsinput',
        'name': 'tags',
        'id': 'tags-input'
    }, ))

    class Meta:
        model = Project
        fields = (
            "name",
            "description",
            "max_people",
            "technical_spec_url",
            "trello",
            "vcs",
            "callback",
            'tags',
            'is_public',
        )

    def save(self, user):
        project = super(ProjectForm, self).save(commit=False)
        is_public = int(self.data['is_public'])
        print(is_public)
        if is_public == 1:
            project.is_public = True
        else:
            project.is_public = 0

        if project.author is None:
            project.author = user
            project.save()
            t = Collaborator(member=user,
                             is_author=True,
                             can_edit_project=True,
                             is_teamlead=True)
            t.save()
            # print(t)
            project.collaborators.add(t)
        project.save()

        return project
Ejemplo n.º 17
0
class AddFeedForm(forms.Form):
    url = forms.URLField(widget=URLInput({
        'placeholder': 'Feed URL',
        'class': 'form-control'
    }))