コード例 #1
0
	def __init__(self, post, *args, **kwargs):
		"""Init form with comment's post to set ready for create. Pass None
		when handling a post method."""

		super(CommentForm, self).__init__(*args, **kwargs)

		if post is not None:
			self.fields['post'] = forms.ModelChoiceField(
				queryset=Post.objects.filter(id=post.id),
				empty_label=None,
				widget=forms.Select(attrs={'style': 'display:none;'})
			)

		self.fields['content'] = QuillFormField()
コード例 #2
0
ファイル: create.py プロジェクト: gonza56d/pyrty
    def get_form(self, form_class=None):
        """Init form by hiding subforum option and leaving current subforum 
        as the only choice."""

        form = super(CreatePost, self).get_form(form_class)

        form.fields['subforum'] = forms.ModelChoiceField(
            queryset=Subforum.objects.filter(pk=self.subforum.id),
            empty_label=None,
            label='',
            widget=forms.Select(attrs={
                'class': 'form-control',
                'style': 'display:none;'
            }))
        form.fields['title'].label = _('Title')
        form.fields['title'].widget = forms.TextInput(attrs={
            'class': 'form-control my-2',
            'placeholder': _('Title')
        })
        form.fields['content'] = QuillFormField()
        form.fields['content'].label = _('Content')
        return form
コード例 #3
0
ファイル: forms.py プロジェクト: platothegeek/theSCPdatabase
class QuillFieldForm(forms.Form):
    content = QuillFormField()
コード例 #4
0
class QuillFieldForm(forms.Form):
    body = QuillFormField()
コード例 #5
0
ファイル: forms.py プロジェクト: fross123/the-u-network
class NewPost(forms.Form):
    content = QuillFormField()
コード例 #6
0
class QuillFieldForm(forms.Form):
    content = QuillFormField()

    def save(self):
        return QuillPost.objects.create(content=self.cleaned_data['content'])
コード例 #7
0
class QuillForm(forms.Form):
    quill = QuillFormField()