Sanitize richt text field content
This commit is contained in:
parent
1e52768820
commit
0322b3b28e
2 changed files with 66 additions and 12 deletions
|
|
@ -1,13 +1,12 @@
|
|||
from django import forms
|
||||
from django.contrib import admin, auth
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from adminsortable2.admin import SortableAdminMixin
|
||||
from tinymce.widgets import TinyMCE
|
||||
|
||||
from froide.helper.widgets import TagAutocompleteWidget
|
||||
|
||||
from .forms import GovernmentPlanForm, GovernmentPlanUpdateForm
|
||||
from .models import (
|
||||
Government,
|
||||
GovernmentPlan,
|
||||
|
|
@ -22,7 +21,7 @@ class GovPlanAdminSite(admin.AdminSite):
|
|||
site_header = "Regierungsvorhaben"
|
||||
|
||||
|
||||
class GovernmentPlanAdminForm(forms.ModelForm):
|
||||
class GovernmentPlanAdminForm(GovernmentPlanForm):
|
||||
class Meta:
|
||||
model = GovernmentPlan
|
||||
fields = "__all__"
|
||||
|
|
@ -33,13 +32,6 @@ class GovernmentPlanAdminForm(forms.ModelForm):
|
|||
}
|
||||
|
||||
|
||||
class GovernmentPlanUpdateAdminForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = GovernmentPlanUpdate
|
||||
fields = "__all__"
|
||||
widgets = {"content": TinyMCE(attrs={"cols": 80, "rows": 30})}
|
||||
|
||||
|
||||
class GovernmentAdmin(admin.ModelAdmin):
|
||||
prepopulated_fields = {"slug": ("name",)}
|
||||
list_display = ("name", "public", "start_date", "end_date")
|
||||
|
|
@ -58,7 +50,7 @@ def get_allowed_plans(request):
|
|||
|
||||
|
||||
class GovernmentPlanAdmin(admin.ModelAdmin):
|
||||
form = GovernmentPlanAdminForm
|
||||
form = GovernmentPlanForm
|
||||
|
||||
save_on_top = True
|
||||
prepopulated_fields = {"slug": ("title",)}
|
||||
|
|
@ -122,7 +114,7 @@ class GovernmentPlanAdmin(admin.ModelAdmin):
|
|||
|
||||
|
||||
class GovernmentPlanUpdateAdmin(admin.ModelAdmin):
|
||||
form = GovernmentPlanUpdateAdminForm
|
||||
form = GovernmentPlanUpdateForm
|
||||
save_on_top = True
|
||||
raw_id_fields = ("user", "foirequest")
|
||||
date_hierarchy = "timestamp"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue