Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from django import forms
from martor.fields import MartorFormField
from app.models import Post
class SimpleForm(forms.Form):
title = forms.CharField(widget=forms.TextInput())
description = MartorFormField()
wiki = MartorFormField()
class PostForm(forms.ModelForm):
class Meta:
model = Post
fields = '__all__'
def __init__(self, *args, **kwargs):
# to setup the editor without label
if not MARTOR_ENABLE_LABEL:
kwargs['label'] = ''
super(MartorFormField, self).__init__(*args, **kwargs)
if not issubclass(self.widget.__class__, MartorWidget):
self.widget = MartorWidget()
from django import forms
from martor.fields import MartorFormField
from app.models import Post
class SimpleForm(forms.Form):
title = forms.CharField(widget=forms.TextInput())
description = MartorFormField()
wiki = MartorFormField()
class PostForm(forms.ModelForm):
class Meta:
model = Post
fields = '__all__'