示例#1
0
class GoodDrugAttrForm(forms.Form):
    """商品列表添加Form"""
    fk_good_id = forms.IntegerField(required=False)
    external_id = forms.CharField(required=True, max_length=80)
    name = forms.CharField(required=True, max_length=80)
    trade_name = forms.CharField(required=True, max_length=80)
    brand = forms.CharField(required=False, max_length=30)
    category = forms.IntegerField(required=True)
    supplier = forms.IntegerField(required=False)
    manufacturer = forms.CharField(required=True)
    locality = forms.CharField(required=True,
                               max_length=20)  # 如:浙江 杭州,湖北 武汉,北京,上海
    # 包装价格
    unit = forms.CharField(required=True, max_length=10)  # 如:盒,瓶,箱,袋
    prep_spec = forms.CharField(required=True, max_length=30)  # 如:0.5g
    pack_spec = forms.CharField(required=True,
                                max_length=10)  # 如:瓶100片,可用药品电子监管码查询到
    retail_price = forms.IntegerField(required=True)  # 单位:分
    member_price = forms.IntegerField(required=True)  # 单位:分
    # 库存数量定期从中间数据库中的 GoodStock 去读取,并更新本地数据库
    stock_amount = forms.IntegerField(required=True)
    # 商品属性
    license = forms.CharField(required=True)
    dosage_form = forms.CharField(required=False)
    otc_type = forms.IntegerField(required=False)
    recipe_type = forms.CharField(required=False)
    is_otc = forms.IntegerField(required=True)
    is_zybh = forms.IntegerField(required=True)
    is_new = forms.IntegerField(required=True)  # 新药:未曾在中国境内上市销售的药品。
    is_oem = forms.IntegerField(required=True)
    desc_drug = RichTextUploadingFormField(required=False)
    desc_good = RichTextUploadingFormField(required=False)
示例#2
0
    class Meta:
        model = Post
        fields = ['title', 'resume', 'content', 'image']

        widgets = {
            'content':
            RichTextUploadingFormField(config_name="my-custom-toolbar"),
            'resume':
            RichTextUploadingFormField(config_name="my-custom-toolbar")
        }
示例#3
0
 class Meta:
     model = models.Ticket
     fields = [
         'equipment', 'booked_by', 'assigned_to', 'current_os', 'wanted_os',
         'status', 'quote', 'has_charger', 'has_case', 'other_equipment',
         'to_do_by', 'location', 'whats_it_doing', 'work_done'
     ]
     widgets = {
         'booked_by': widgets.AgentWidget(),
         'assigned_to': widgets.AgentWidget(),
         'updater': widgets.AgentWidget(),
         'to_do_by': forms.DateInput(),
         'whats_it_doing': RichTextUploadingFormField(required=True),
         'work_done': RichTextUploadingFormField(required=False)
     }
 class Meta:
     model = models.Item
     fields = [
         'category', 'name', 'brand', 'price', 'description', 'condition', 'changes_made'
     ]
     widgets = {
         'changes_made': RichTextUploadingFormField(required=False)
     }
示例#5
0
class ArticleForm(forms.Form):
    name = forms.CharField(
        label='文章名称',
        required=True,
        widget=forms.TextInput(
            attrs={'style': 'border:1px solid #ccc;width:80%;'}))
    image = forms.ImageField(label='图片', required=True)
    category = forms.ChoiceField(required=True, label="分类")
    content = RichTextUploadingFormField(label='内容', config_name="basic")
示例#6
0
 class Meta:
     model = models.Job
     fields = [
         'assigned_to', 'title', 'description', 'to_do_by', 'completed'
     ]
     widgets = {
         'assigned_to': widgets.AgentWidget(),
         'description': RichTextUploadingFormField(required=False)
     }
示例#7
0
 def __init__(self, *args, **kwargs):
     super(GameLogForm, self).__init__(*args, **kwargs);
     # 新增内容项
     content = "";
     instance = kwargs.get("instance", None);
     if instance:
         content = instance.cid.content;
     self.fields["content"] = RichTextUploadingFormField(label = "详细内容", initial = content);
     self.fields["sketch"].widget = HiddenInput();
示例#8
0
 def __init__(self, *args, **kwargs):
     super(WebItemForm, self).__init__(*args, **kwargs)
     # 新增内容项
     content = ""
     instance = kwargs.get("instance", None)
     if instance:
         content = instance.cid.content
     self.fields["content"] = RichTextUploadingFormField(label="详细内容",
                                                         initial=content)
示例#9
0
class WorkOrderAddForm(forms.Form):
    title = forms.CharField(max_length=100,
                            required=True,
                            error_messages={
                                'required': '标题不能为空',
                                'max_length': '标题超过100个字符'
                            })
    # order_contents = forms.CharField(required=True)
    order_contents = RichTextUploadingFormField(required=True)
    orderfiles = forms.FileField(required=False)
示例#10
0
class SaveNoteForm(forms.Form):
    note_title = forms.CharField(
        max_length=100,
        required=False,
        widget=forms.TextInput(attrs={
            'type': 'text',
            'class': 'form-control',
            'placeholder': 'Название'
        }))
    note_data = RichTextUploadingFormField(widget=CKEditorUploadingWidget())
示例#11
0
class WriteForm(forms.Form):
    title = forms.CharField(
        label="标题",
        max_length=50,
        widget=forms.TextInput(attrs={
            'class': 'title-input',
            'placeholder': "请输入标题(最多50个字)"
        }))
    content = RichTextUploadingFormField(label='内容')
    img = forms.ImageField(widget=forms.FileInput(
        attrs={'style': 'display:none'}))
示例#12
0
class PostCreateForm(forms.ModelForm):
    content = RichTextUploadingFormField()

    def __init__(self, *args, **kwargs):
        self.user = kwargs.pop('user', None)
        super().__init__(*args, **kwargs)
        self.fields['content'].label = '内容'
        self.fields['category'].label = '版块'

    def save(self, commit=True):
        self.instance.creator = self.user
        return super().save(commit=commit)

    class Meta:
        model = Post
        fields = ('title', 'content', 'category')
示例#13
0
class PostForm(forms.ModelForm):
    title = forms.CharField(
        required=True, widget=forms.TextInput(attrs={'class': 'form-control'}))
    category = forms.ModelChoiceField(
        queryset=Category.objects.all(),
        required=True,
        empty_label="----Select Category----",
        widget=forms.Select(attrs={'class': 'form-control'}))
    content = RichTextUploadingFormField(
        required=True, widget=forms.Textarea(attrs={'class': 'form-control'}))
    status = forms.CharField(widget=forms.Select(
        choices=Post.options, attrs={'class': 'form-control'}),
                             required=True)

    class Meta:
        model = Post
        fields = ['title', 'category', 'content', 'status']
示例#14
0
class CommentForm(forms.ModelForm):
    content = RichTextUploadingFormField()
    reply_to = forms.CharField(widget=forms.HiddenInput, required=False)

    def __init__(self, *args, **kwargs):
        self.user = kwargs.pop('user', None)
        self.post = kwargs.pop('post', None)
        super().__init__(*args, **kwargs)
        self.fields['content'].label = ''

    def save(self, commit=True):
        if self.data['reply_to']:
            self.instance.reply_to = self.data['reply_to']
        self.instance.creator = self.user
        self.instance.post = self.post
        return super().save(commit=commit)

    class Meta:
        model = Comments
        fields = ('content', )
示例#15
0
class CreateArticleForm(forms.ModelForm):
    content = RichTextUploadingFormField(label='內文')
    cat = forms.ChoiceField(choices=[('unclassified', '--')],
                            widget=forms.Select(attrs={
                                'style': 'height:30px;',
                            }))

    def __init__(self, *args, **kwargs):
        cat = kwargs.pop('cat', [])
        super(CreateArticleForm, self).__init__(*args, **kwargs)
        self.fields['cat'].label = '分類'
        self.fields['cat'].choices += [(c, c) for c in cat]

    class Meta:
        model = Article
        fields = ['title', 'cat', 'content']
        labels = {
            'title': '文章標題',
            'content': '內文',
        }
        widgets = {'title': forms.TextInput(attrs={'style': 'width:30%;'})}
示例#16
0
class EditEventForm(forms.Form):
    event_edit_description = RichTextUploadingFormField(
        widget=CKEditorUploadingWidget())
    event_edit_title = forms.CharField(
        max_length=30,
        widget=forms.TextInput(attrs={
            'class': 'form-control',
            'placeholder': 'Событие'
        }))
    event_edit_time = forms.TimeField(widget=forms.TimeInput(
        attrs={
            'form': 'edit_todo_form',
            'class': 'form-control',
            'type': 'time'
        }))
    event_edit_deadline = forms.DateField(widget=forms.DateInput(
        attrs={
            'form': 'edit_todo_form',
            'class': 'form-control',
            'type': 'date'
        }))
    event_id = forms.IntegerField(widget=forms.HiddenInput())
    is_public = forms.BooleanField()
示例#17
0
class AddEventForm(forms.Form):
    """!
        @brief Form that handles user's event for writing to DB
    """
    date = forms.DateField(widget=forms.DateInput(attrs={
        'form': 'add_event_form',
        'type': 'date'
    }))
    time = forms.TimeField(widget=forms.TimeInput(attrs={
        'form': 'add_event_form',
        'type': 'time'
    }))
    title = forms.CharField(max_length=256,
                            widget=forms.TextInput(
                                attrs={
                                    'class': 'form-control',
                                    'placeholder': 'Мероприятиеюшка',
                                    'type': 'name'
                                }))
    description = RichTextUploadingFormField(widget=CKEditorUploadingWidget())
    is_public = forms.BooleanField(required=False,
                                   widget=forms.CheckboxInput(
                                       attrs={
                                           'class': 'form-check-input',
                                           'form': 'add_event_form',
                                           'type': 'checkbox'
                                       }))
    should_notify_days = forms.IntegerField(min_value=0,
                                            max_value=30,
                                            required=False)
    should_notify_hours = forms.IntegerField(min_value=0,
                                             max_value=23,
                                             required=False)
    should_notify_minutes = forms.IntegerField(min_value=0,
                                               max_value=59,
                                               required=False)
    place = forms.CharField(max_length=255, required=None)
示例#18
0
class ArticleAdminForm(forms.ModelForm):
    content = RichTextUploadingFormField(required=False)

    class Meta:
        model = Article
        fields = [
            'author', 'page_name', 'title', 'keywords', 'description',
            'public_image', 'status'
        ]

    def get_initial_for_field(self, field, field_name):
        try:
            # Adding existing html into the CKEditor
            page_name = self.initial['page_name']
            if page_name:
                article_file_path = f'{get_article_dir_path()}' \
                                    f'/{page_name}.html'
                raw_html = read_article_html_text(article_file_path)
                self.initial['content'] = raw_html
        except Exception:
            pass

        return super(ArticleAdminForm, self) \
            .get_initial_for_field(field, field_name)
示例#19
0
文件: forms.py 项目: YSU-666/ysu_web
class Publish_form(forms.Form):
    title = forms.CharField(max_length=50)
    content = RichTextUploadingFormField()
示例#20
0
文件: forms.py 项目: vlctt/studio
class CkEditorForm(forms.Form):
    content = RichTextUploadingFormField(label='内容')
示例#21
0
from .models import Articles


class ArticlesBaseForm(forms.ModelForm):
    class Meta:
        abstract = True
        model = Articles
        fields = ("title", "content", "allow_comment", "status", "category",
                  "tags")


class ArticlesForm(ArticlesBaseForm):
    """"""
    # content = forms.CharField(widget=PagedownWidget())
    content = MartorFormField()


class ArticlesPagedownForm1(ArticlesBaseForm):
    content = forms.CharField(widget=PagedownWidget(show_preview=True))


ArticlesPagedownForm = type(
    '', (ArticlesBaseForm, ),
    {'content': forms.CharField(widget=PagedownWidget(show_preview=True))})

ArticlesMarkdownXForm = type('', (ArticlesBaseForm, ),
                             {'content': MarkdownxFormField()})

ArticlesCkeditorForm = type('', (ArticlesBaseForm, ),
                            {'content': RichTextUploadingFormField()})
示例#22
0
class NewTodoForm(forms.ModelForm):
    text = RichTextUploadingFormField()

    class Meta:
        model = Todo
        exclude = ['created_by']
示例#23
0
class CkEditorForm(forms.Form):
    ckeditor_standard_example = RichTextFormField()
    ckeditor_upload_example = RichTextUploadingFormField(
        config_name="my-custom-toolbar")
示例#24
0
# coding=UTF-8
示例#25
0
class Do_practiceForm(forms.Form):
    answer = RichTextUploadingFormField(config_name='answer')
示例#26
0
class PublishForm(forms.Form):
    content = RichTextUploadingFormField(label='',
                                         config_name='publish',
                                         error_messages={'required': '内容不能为空'})
示例#27
0
class PostForm(forms.Form):
    content = RichTextUploadingFormField(config_name='post_ckeditor')
示例#28
0
class AuthorsAdminForm(forms.ModelForm):
    bio = RichTextUploadingFormField(config_name='authors_config')

    class Meta:
        model = Article
        fields = '__all__'