| 12345678910111213141516171819 |
- from django import forms
- from tinymce.widgets import TinyMCE
- from landing.models import LandingPage
- from landing.rich_text import sanitize_rich_html
- class LandingPageAdminForm(forms.ModelForm):
- """Editor widget boundary for LandingPage rich HTML."""
- class Meta:
- model = LandingPage
- fields = "__all__"
- widgets = {
- "content": TinyMCE(attrs={"cols": 80, "rows": 24}),
- }
- def clean_content(self):
- return sanitize_rich_html(self.cleaned_data.get("content"))
|