def __init__(self, *args, **kwargs): node = kwargs.pop("node") super(NodeAnnotationEditForm, self).__init__(*args, **kwargs) upload_url = reverse_lazy("upload_attachment_node", args=[node.pk]) self.fields["text"].widget = Wysiwyg(mode="full", upload_url=upload_url)
def __init__(self, *args, **kwargs): node = kwargs.pop("node") super(NodeAnnotationEditForm, self).__init__(*args, **kwargs) upload_url = reverse_lazy("upload_attachment_node", args=[node.pk]) self.fields["text"].widget = Wysiwyg( mode="full", upload_url=upload_url )
def __init__(self, *args, **kwargs): super(PerexesEditForm, self).__init__(*args, **kwargs) upload_url = reverse_lazy("upload_attachment_node", args=[self.instance.pk]) for key in Node.WYSIWYG_FIELDS: if key not in self.fields: continue self.fields[key].widget = Wysiwyg(mode="full", upload_url=upload_url)
def __init__(self, *args, **kwargs): super(PerexesEditForm, self).__init__(*args, **kwargs) upload_url = reverse_lazy("upload_attachment_node", args=[self.instance.pk]) for key in Node.WYSIWYG_FIELDS: if key not in self.fields: continue self.fields[key].widget = Wysiwyg( mode="full", upload_url=upload_url )
def __init__(self, answer, revision, *args, **kwargs): self.answer = answer super(EditAnswerForm, self).__init__(*args, **kwargs) #it is important to add this field dynamically self.fields['text'] = WysiwygFormField(min_length=openode_settings.MIN_ANSWER_BODY_LENGTH) self.fields['text'].widget = Wysiwyg( mode="full", upload_url=reverse_lazy("upload_attachment_node", args=[self.answer.thread.node.pk]) ) self.fields['text'].initial = revision.text
def __init__(self, *args, **kwargs): self.node = kwargs.pop("node") super(AnswerForm, self).__init__(*args, **kwargs) self.fields['email_notify'].widget.attrs['id'] = 'question-subscribe-updates' self.fields["text"].min_length = openode_settings.MIN_ANSWER_BODY_LENGTH self.fields["text"].widget = Wysiwyg( mode="full", upload_url=reverse_lazy("upload_attachment_node", args=[self.node.pk]) )
def __init__(self, answer, revision, *args, **kwargs): self.answer = answer super(EditAnswerForm, self).__init__(*args, **kwargs) #it is important to add this field dynamically self.fields['text'] = WysiwygFormField( min_length=openode_settings.MIN_ANSWER_BODY_LENGTH) self.fields['text'].widget = Wysiwyg( mode="full", upload_url=reverse_lazy("upload_attachment_node", args=[self.answer.thread.node.pk])) self.fields['text'].initial = revision.text
def __init__(self, *args, **kwargs): self.user = kwargs.pop('user') self.node = kwargs.pop('node') allow_tags = kwargs.pop("allow_tags", True) super(AskForm, self).__init__(*args, **kwargs) if allow_tags and self.user.has_perm('openode.change_tag'): self.fields['tags'] = TagNamesField() self.fields["text"].widget = Wysiwyg( mode="full", upload_url=reverse_lazy("upload_attachment_node", args=[self.node.pk]) )
def __init__(self, *args, **kwargs): self.node = kwargs.pop("node") super(AnswerForm, self).__init__(*args, **kwargs) self.fields['email_notify'].widget.attrs[ 'id'] = 'question-subscribe-updates' self.fields[ "text"].min_length = openode_settings.MIN_ANSWER_BODY_LENGTH self.fields["text"].widget = Wysiwyg(mode="full", upload_url=reverse_lazy( "upload_attachment_node", args=[self.node.pk]))
def __init__(self, *args, **kwargs): self.user = kwargs.pop('user') self.node = kwargs.pop('node') allow_tags = kwargs.pop("allow_tags", True) super(AskForm, self).__init__(*args, **kwargs) if allow_tags and self.user.has_perm('openode.change_tag'): self.fields['tags'] = TagNamesField() self.fields["text"].widget = Wysiwyg(mode="full", upload_url=reverse_lazy( "upload_attachment_node", args=[self.node.pk]))
def __init__(self, *args, **kwargs): """ overwrite default simple wysiwyg """ super(NodeAdminForm, self).__init__(*args, **kwargs) widget_attrs = { "mode": "full", "width": "800px", } if self.instance.pk: widget_attrs.update({ "upload_url": reverse_lazy("upload_attachment_node", args=[self.instance.pk]) }) for key in Node.WYSIWYG_FIELDS: self.fields[key].widget = Wysiwyg(**widget_attrs)
def __init__(self, *args, **kwargs): """populate EditQuestionForm with initial data""" self.main_post = kwargs.pop('main_post') self.user = kwargs.pop('user') # preserve for superclass revision = kwargs.pop('revision') self.node = kwargs.pop('node') text_required = kwargs.pop("text_required", True) super(EditQuestionForm, self).__init__(*args, **kwargs) #it is important to add this field dynamically self.fields['text'] = WysiwygFormField() self.fields['text'].widget = Wysiwyg( mode="full", upload_url=reverse_lazy("upload_attachment_node", args=[self.node.pk]) ) self.fields['text'].initial = revision.text self.fields['text'].required = text_required # TODO: use Thread.can_retag method if self.user.has_perm('openode.change_tag'): self.fields['tags'] = TagNamesField() self.fields['tags'].initial = revision.tagnames self.fields['title'].initial = revision.title self.fields['allow_external_access'] = forms.BooleanField( label=_('Allow external access'), initial=self.main_post.thread.external_access, required=False ) self.fields["category"] = TreeNodeChoiceField( queryset=self.main_post.thread.node.thread_categories.all(), initial=self.main_post.thread.category, required=False, )
def __init__(self, *args, **kwargs): """populate EditQuestionForm with initial data""" self.main_post = kwargs.pop('main_post') self.user = kwargs.pop('user') # preserve for superclass revision = kwargs.pop('revision') self.node = kwargs.pop('node') text_required = kwargs.pop("text_required", True) super(EditQuestionForm, self).__init__(*args, **kwargs) #it is important to add this field dynamically self.fields['text'] = WysiwygFormField() self.fields['text'].widget = Wysiwyg(mode="full", upload_url=reverse_lazy( "upload_attachment_node", args=[self.node.pk])) self.fields['text'].initial = revision.text self.fields['text'].required = text_required # TODO: use Thread.can_retag method if self.user.has_perm('openode.change_tag'): self.fields['tags'] = TagNamesField() self.fields['tags'].initial = revision.tagnames self.fields['title'].initial = revision.title self.fields['allow_external_access'] = forms.BooleanField( label=_('Allow external access'), initial=self.main_post.thread.external_access, required=False) self.fields["category"] = TreeNodeChoiceField( queryset=self.main_post.thread.node.thread_categories.all(), initial=self.main_post.thread.category, required=False, )