Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend RichtTextFields to auto clean html #213

Open
kleingeist opened this issue Nov 15, 2017 · 0 comments
Open

Extend RichtTextFields to auto clean html #213

kleingeist opened this issue Nov 15, 2017 · 0 comments

Comments

@kleingeist
Copy link
Contributor

Currently Uploading|RichTextFields are cleaned from unallowed html by using the models save() method [1].
As this is prone for errors because devs forget to call the clean method manually we should extend Uploading|RichTextFields to auto clean their html.
This could be achieved by using a custom field that overwrites the pre_save method [2] as described by [3].

[1] https://github.com/liqd/a4-meinberlin/blob/master/meinberlin/apps/ideas/models.py#L44
[2] https://docs.djangoproject.com/en/1.11/ref/models/fields/#django.db.models.Field.pre_save
[3] https://docs.djangoproject.com/en/1.11/howto/custom-model-fields/#preprocessing-values-before-saving

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant