Coverage for jutil/modelfields.py: 100%

# Coverage for jutil/modelfields.py : 100%

## 8 statements

Hot-keys on this page

r m x p toggle line displays

j k next/prev highlighted chunk

0 (zero) top of page

1 (one) first highlighted chunk

1 from django.db import models

2 from django.utils.html import strip_tags

3

4

5 class SafeCharField(models.CharField):

6 """

7 CharField which strips HTML tags from form data on save.

8 """

9 def save_form_data(self, instance, data):

10 setattr(instance, self.name, strip_tags(str(data)) if data else data)

11

12

13 class SafeTextField(models.TextField):

14 """

15 TextField which strips HTML tags from form data on save.

16 """

17 def save_form_data(self, instance, data):

18 setattr(instance, self.name, strip_tags(str(data)) if data else data)