mirror of https://github.com/logos-co/open-law.git
clean_up done
This commit is contained in:
parent
c82f90c6fb
commit
377c3f0092
|
@ -1,7 +1,10 @@
|
|||
from flask_wtf import FlaskForm
|
||||
from wtforms import StringField, SubmitField
|
||||
from wtforms import StringField, SubmitField, ValidationError
|
||||
from wtforms.validators import DataRequired
|
||||
|
||||
from app.controllers import clean_html
|
||||
from app.logger import log
|
||||
|
||||
|
||||
class BaseInterpretationForm(FlaskForm):
|
||||
about = StringField("About")
|
||||
|
@ -12,6 +15,14 @@ class CreateInterpretationForm(BaseInterpretationForm):
|
|||
section_id = StringField("Interpretation ID", [DataRequired()])
|
||||
submit = SubmitField("Create")
|
||||
|
||||
def validate_text(self, field):
|
||||
text = clean_html(field.data)
|
||||
text = text.replace(" ", "")
|
||||
text = text.strip()
|
||||
if len(text) < 1:
|
||||
log(log.WARNING, "Can't submit empty interpretation")
|
||||
raise ValidationError("You can't create interpretation with no text")
|
||||
|
||||
|
||||
class EditInterpretationForm(BaseInterpretationForm):
|
||||
interpretation_id = StringField("Interpretation ID", [DataRequired()])
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -46,6 +46,10 @@ export function addSection() {
|
|||
`${collectionId}/${subCollectionId}/create_section`,
|
||||
);
|
||||
}
|
||||
if (newActionPath.includes('/0')) {
|
||||
console.log('ALERT');
|
||||
return;
|
||||
}
|
||||
|
||||
addSectionForm.setAttribute('action', `${newActionPath}`);
|
||||
sectionModal.show();
|
||||
|
|
Loading…
Reference in New Issue