File: models.py

package info (click to toggle)
django-bleach 3.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 324 kB
  • sloc: python: 993; makefile: 137; sh: 16
file content (17 lines) | stat: -rw-r--r-- 539 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from django.db import models

from bleach.css_sanitizer import CSSSanitizer

from django_bleach.models import BleachField


class Person(models.Model):
    name = models.CharField(max_length=20)
    biography = BleachField(
        max_length=100,
        verbose_name='Person biography',
        allowed_tags=['p', 'a', 'li', 'ul', 'strong'],
        allowed_attributes=['class', 'href', 'style'],
        allowed_protocols=['http', 'https'],
        css_sanitizer=CSSSanitizer(allowed_css_properties=['color', 'background-color'])
    )