X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/785e43023395a5d9854c0c5469d1d7b0558459e4..d1ef1bf6cf243a1cc9bbb2df1baef252f0628de3:/apps/wiki/forms.py diff --git a/apps/wiki/forms.py b/apps/wiki/forms.py index 772e0be6..141f1b6b 100644 --- a/apps/wiki/forms.py +++ b/apps/wiki/forms.py @@ -7,6 +7,7 @@ from django import forms from django.utils.translation import ugettext_lazy as _ from catalogue.models import Chunk +from catalogue.xml_tools import remove_empty_elements class DocumentPubmarkForm(forms.Form): @@ -79,6 +80,10 @@ class DocumentTextSaveForm(forms.Form): self.fields['for_cybernauts'].initial = self.chunk.book.for_cybernauts self.fields['publishable'].initial = self.chunk.head.publishable + def clean_text(self): + text = self.cleaned_data.get('text', '') + return remove_empty_elements(text) + def save(self): if self.user.is_authenticated(): author = self.user