Skip to content

Commit

Permalink
Merge pull request #2176 from IFRCGo/fix/no-rich-text-fr-summary
Browse files Browse the repository at this point in the history
No rich text in FR summary
  • Loading branch information
szabozoltan69 authored Jun 17, 2024
2 parents 85694a2 + 808b2af commit 1dc124e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
5 changes: 4 additions & 1 deletion api/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from lang.admin import TranslationAdmin, TranslationInlineModelAdmin
from notifications.models import RecordType, SubscriptionType

from .forms import ActionForm
from .forms import ActionForm, SocietyNamePlain, SummaryPlain

# from reversion.models import Revision

Expand Down Expand Up @@ -317,6 +317,8 @@ class FieldReportAdmin(CompareVersionAdmin, RegionRestrictedAdmin, TranslationAd
"countries",
"districts",
)
form = SummaryPlain

readonly_fields = ("report_date", "created_at", "updated_at")
list_filter = [MembershipFilter]
actions = [
Expand Down Expand Up @@ -648,6 +650,7 @@ class CountryAdmin(geoadmin.OSMGeoAdmin, CompareVersionAdmin, RegionRestrictedAd
CountryICRCPresenceInline,
]
exclude = ("key_priorities",)
form = SocietyNamePlain


class RegionAdmin(geoadmin.OSMGeoAdmin, CompareVersionAdmin, RegionRestrictedAdmin, TranslationAdmin):
Expand Down
20 changes: 20 additions & 0 deletions api/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,23 @@ class ActionForm(forms.ModelForm):
class Meta:
model = Action
fields = "__all__"


class SocietyNamePlain(forms.ModelForm):
class Meta:
widgets = {
"society_name_en": forms.Textarea(attrs={"class": "plain-textarea"}),
"society_name_es": forms.Textarea(attrs={"class": "plain-textarea"}),
"society_name_fr": forms.Textarea(attrs={"class": "plain-textarea"}),
"society_name_ar": forms.Textarea(attrs={"class": "plain-textarea"}),
}


class SummaryPlain(forms.ModelForm):
class Meta:
widgets = {
"summary_en": forms.Textarea(attrs={"class": "plain-textarea"}),
"summary_es": forms.Textarea(attrs={"class": "plain-textarea"}),
"summary_fr": forms.Textarea(attrs={"class": "plain-textarea"}),
"summary_ar": forms.Textarea(attrs={"class": "plain-textarea"}),
}
7 changes: 2 additions & 5 deletions main/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,17 +326,14 @@
},
]

# selector – exclude Geometry fields (bbox) and some plain textareas (see forms.py)
TINYMCE_DEFAULT_CONFIG = {
"selector": "textarea:not(.vWKTField):not(.plain-textarea)",
"entity_encoding": "raw",
"height": 360,
"width": 1120,
"cleanup_on_startup": True,
"custom_undo_redo_levels": 20,
"selector": "textarea:not(.vWKTField)"
":not(.mt-field-society_name-en)"
":not(.mt-field-society_name-es)"
":not(.mt-field-society_name-fr)"
":not(.mt-field-society_name-ar)",
"plugins": '''
anchor autolink charmap code codesample directionality
fullscreen image insertdatetime link lists media
Expand Down

0 comments on commit 1dc124e

Please sign in to comment.