Esempio n. 1
0
class ArticleAdminForm(forms.ModelForm):
    content = forms.CharField(widget=FroalaEditor())
    source = forms.CharField(widget=FroalaEditor())

    class Meta:
        model = Article
        fields = '__all__'
Esempio n. 2
0
    class Meta:
        model = Tag
        fields = ('name',
                  'url', 'private', 'rateable', 'description')
        widgets = {
            'description': FroalaEditor(
                options={'toolbarInline': False,
                         'iframe': False,
                         'toolbarSticky': False,
                         'imageDefaultWidth': 800,
                         'language': 'ru',
                         'placeholderText': '''Напишите что-нибудь
                                          или перетащите изображение''',
                         'imageMaxSize': 1024 * 1024 * 19,
                         'pasteDeniedTags': ['script'],
                         'imageEditButtons': [
                             'imageAlign', 'imageRemove',
                             '|', 'imageLink', 'linkOpen',
                             'linkEdit', 'linkRemove', '-',
                             'imageDisplay', 'imageStyle',
                             'imageAlt', 'imageSize', 'html'
                         ]},
                plugins=('align', 'char_counter', 'code_beautifier',
                         'code_view', 'colors', 'draggable', 'emoticons',
                         'entities', 'file', 'font_family', 'font_size',
                         'fullscreen', 'image_manager', 'image', 'inline_style',
                         'line_breaker', 'link', 'lists', 'paragraph_format',
                         'paragraph_style', 'quick_insert', 'quote', 'save', 'table',
                         'url', 'video'),
            ),

        }
Esempio n. 3
0
 class Meta:
     model = Post
     exclude = ("slug", "date")
     title = forms.CharField(required=True)
     content = forms.CharField(widget=FroalaEditor(options={
         'toolbarInline': True,
     }))
Esempio n. 4
0
 class Meta:
     model = Profile
     fields = [
         'first_name',
         'last_name',
         'date_of_birth',
         'favorite_animal',
         'favorite_food',
         'hobby',
         'bio',
         'image',
     ]
     widgets = {
         'date_of_birth':
         DatePickerInput(
             options={
                 'format': 'YYYY-MM-DD',
                 'extraFormats': [
                     'MM/DD/YY',
                     'MM/DD/YYYY',
                 ],
             }),
         'bio':
         FroalaEditor()
     }
     input_formats = {'date_of_birth': ['%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y']}
Esempio n. 5
0
class QuestionCommentForm(forms.ModelForm):
    content = forms.CharField(widget=FroalaEditor(
        options={
            'toolbarInline':
            True,
            'charCounterCount':
            False,
            'toolbarButtons': [
                'bold', 'italic', 'underline', 'strikeThrough', 'subscript',
                'superscript', '-', 'paragraphFormat', 'align', 'formatOL',
                'formatUL', 'indent', 'outdent', '-', 'insertImage',
                'insertLink', 'insertFile', 'insertVideo', 'undo', 'redo'
            ],
            'toolbarVisibleWithoutSelection':
            True
        }))

    class Meta:
        model = QuestionComment
        fields = ['comment_description']

    def save(self, commit=True):

        user = super(QuestionCommentForm, self).save(commit=False)
        user.is_active = False
        if commit:
            user.save()
        return user
Esempio n. 6
0
 def formfield(self, **kwargs):
     defaults = {
         'widget':
         FroalaEditor(options=self.options,
                      image_upload=self.image_upload,
                      file_upload=self.file_upload)
     }
     defaults.update(kwargs)
     return super(FroalaField, self).formfield(**defaults)
Esempio n. 7
0
class AnsForm(ModelForm):
    body = forms.CharField(widget=FroalaEditor(options={
        'toolbarInline': False,
        'image_upload': True,
        'height': 200,
        'width': 600,
    }))
    class Meta:
        model = Answer
        fields = ['body']
Esempio n. 8
0
 class Meta:
     fields = '__all__'
     model = FroalaPost
     widgets = {
         'content': FroalaEditor(options={
             'height': 600, 'width': '60%',
             'placeholderText': 'test',
         }),
         
     }
Esempio n. 9
0
 def formfield(self, **kwargs):
     if self.use_froala:
         widget = FroalaEditor(options=self.options, theme=self.theme, plugins=self.plugins,
                               include_jquery=self.include_jquery, image_upload=self.image_upload,
                               file_upload=self.file_upload, third_party=self.third_party)
     else:
         widget = Textarea()
     defaults = {'widget': widget}
     defaults.update(kwargs)
     return super(FroalaField, self).formfield(**defaults)
Esempio n. 10
0
 class Meta:
     model = Post
     exclude = [
         'published_date', 'clicks', 'likes', 'dislikes', 'preferences',
         'meta_keywords'
     ]
     widgets = {
         'text': FroalaEditor(image_upload=True),
     }
     labels = {'title': 'Naslov', 'topic': 'Tema'}
Esempio n. 11
0
class CommentForm(ModelForm):
    commentbody = forms.CharField(widget=FroalaEditor(options={
        'toolbarInline': False,
        'image_upload': True,
        'height': 200,
        'width': 600,
    }))
    class Meta:
        model = QComment
        fields = ['commentbody']        
Esempio n. 12
0
 class Meta:
     model = models.TermContent
     widgets = {
         'extended_description': FroalaEditor(),
         'version':
         autocomplete.ModelSelect2(url='termversion-autocomplete'),
     }
     fields = [
         'title', 'language', 'version', 'acronym', 'description',
         'extended_description'
     ]
Esempio n. 13
0
class FlatPageAdmin(TabbedTranslationAdmin, FA):
    form = FlatpageForm

    formfield_overrides = {
        models.TextField: {
            'widget': FroalaEditor(attrs={
                'rows': 20,
                'cols': 100
            })
        },
    }
Esempio n. 14
0
 class Meta:
     model = Post
     fields = ['title', 'content', 'status', 'category', 'image']
     widgets = {
         'title':
         forms.Textarea(attrs={
             'class': 'post-title-input',
             'placeholder': 'Title'
         }),
         'content':
         FroalaEditor(),
     }
Esempio n. 15
0
 def formfield(self, **kwargs):
     defaults = {
         'widget':
         FroalaEditor(options=self.options,
                      theme=self.theme,
                      plugins=self.plugins,
                      include_jquery=self.include_jquery,
                      image_upload=self.image_upload,
                      file_upload=self.file_upload)
     }
     defaults.update(kwargs)
     return super(FroalaField, self).formfield(**defaults)
Esempio n. 16
0
    class Meta():
        model = Post
        fields = ('title', 'tags', 'content', 'featured_image')

        widgets = {
            'title':
            forms.Textarea(attrs={
                'class': 'post-title-input',
                'placeholder': 'Title'
            }),
            'content':
            FroalaEditor(),
        }
Esempio n. 17
0
class PostForm(forms.ModelForm):
    content = forms.CharField(widget=FroalaEditor())
    publish = forms.DateField(widget=forms.SelectDateWidget)

    class Meta:
        model = Post
        fields = [
            "title",
            "content",
            "image",
            "draft",
            "publish",
        ]
Esempio n. 18
0
 class Meta:
     model = Project
     fields = ['title', 'content']
     widgets = {
         'content':
         FroalaEditor(),
         'title':
         forms.TextInput(
             attrs={
                 'style': 'height: 30px; margin-bottom:15px; width:300px;',
                 'class': 'form-control',
                 'autocomplete': 'off'
             })
     }
Esempio n. 19
0
class PostForm(forms.ModelForm):
    content = forms.CharField(widget=FroalaEditor(options={
        'toolbarInline': False,
        'heightMin': 300,
    }))
    title = forms.CharField(widget=forms.TextInput(
        attrs={'placeholder': 'Type some Title'}))

    class Meta:
        model = Post
        fields = ['title', 'content', 'status', 'category', 'featured_image']

    def __init__(self, *args, **kwargs):
        super(PostForm, self).__init__(*args, **kwargs)
        for visible in self.visible_fields():
            visible.field.widget.attrs['class'] = 'form-control'
Esempio n. 20
0
class EmailForm(forms.Form):
    sender = forms.EmailField()
    receiver = forms.EmailField(widget=forms.Textarea(
        attrs={
            'class': 'textarea',
            'placeholder': '[email protected]\[email protected]'
        }))
    subject = forms.CharField(max_length=75,
                              widget=forms.TextInput(attrs={'class': 'input'}))
    content = forms.CharField(widget=FroalaEditor(options={
        'useClasses': False,
    }))

    attachments = forms.FileField(
        required=False,
        widget=forms.ClearableFileInput(attrs={'multiple': True}))
Esempio n. 21
0
class PageForm(forms.ModelForm):
    slug = forms.CharField(widget=forms.TextInput(attrs={'readonly': 'True'}),
                           required=False)
    content = forms.CharField(widget=FroalaEditor(options={
        "heightMin":
        200,
        "iframeStyleFiles":
        [static('css/bootstrap.min.css'),
         static('css/main.min.css')],
        "iframe":
        True
    },
                                                  image_upload=True))

    class Meta:
        model = Page
        fields = ('title', 'content', 'slug')
Esempio n. 22
0
class PostForm(forms.ModelForm):
    content = forms.CharField(widget=FroalaEditor(theme='dark'))
    draft = forms.BooleanField
    image = forms.FileField
    publish = forms.DateField(required=False)

    def clean_image(self):

        image = self.cleaned_data.get('image', False)
        if image:
            if image._size > 8 * 1024 * 1024:
                raise ValidationError("Image file too large ( > 4mb )")
            return image
        else:
            image = ""
        return image

    class Meta:
        model = Post
        fields = ["title", "content", "image", 'draft', 'publish']
Esempio n. 23
0
class PageAdminForm(forms.ModelForm):
    content = forms.CharField(widget=FroalaEditor())

    class Meta:
        model = Page
        fields = '__all__'
Esempio n. 24
0
class PageForm(forms.ModelForm):
    content = forms.CharField(widget=FroalaEditor(options={
        'toolbarInline': True,
    }))
Esempio n. 25
0
class AnimalAdminForm(forms.ModelForm):
    description = forms.CharField(widget=FroalaEditor())

    class Meta:
        model = Animal
        fields = '__all__'