import bleach


DESCR_ALLOWED_TAGS = bleach.ALLOWED_TAGS + ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']
USER_DESCR_ALLOWED_TAGS = bleach.ALLOWED_TAGS + ['h2', 'h3', 'h4', 'h5', 'h6']


def clean_for_user_description(html):
    """
    Removes dangerous tags, including h1.
    """
    return bleach.clean(html, tags=USER_DESCR_ALLOWED_TAGS, strip=True)


def clean_for_description(html):
    """
    Removes dangerous tags.
    """
    return bleach.clean(html, tags=DESCR_ALLOWED_TAGS, strip=True)


def clean_all(html):
    """
    Removes *all* html tags.
    """
    return bleach.clean(html, tags=[], styles=[], attributes=[], strip=True)

import bleach


DESCR_ALLOWED_TAGS = bleach.ALLOWED_TAGS + ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'br', 'p']
USER_DESCR_ALLOWED_TAGS = bleach.ALLOWED_TAGS + ['h2', 'h3', 'h4', 'h5', 'h6', 'br', 'p']


def clean_for_user_description(html):
    """
    Removes dangerous tags, including h1.
    """
    return bleach.clean(html, tags=USER_DESCR_ALLOWED_TAGS, strip=True)


def clean_for_description(html):
    """
    Removes dangerous tags.
    """
    return bleach.clean(html, tags=DESCR_ALLOWED_TAGS, strip=True)


def clean_all(html):
    """
    Removes *all* html tags.
    """
    return bleach.clean(html, tags=[], styles=[], attributes=[], strip=True)

Allow <br /> and <p> in descriptions
Allow <br /> and <p> in descriptions

  import bleach
  
  
- DESCR_ALLOWED_TAGS = bleach.ALLOWED_TAGS + ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']
+ DESCR_ALLOWED_TAGS = bleach.ALLOWED_TAGS + ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'br', 'p']
- USER_DESCR_ALLOWED_TAGS = bleach.ALLOWED_TAGS + ['h2', 'h3', 'h4', 'h5', 'h6']
+ USER_DESCR_ALLOWED_TAGS = bleach.ALLOWED_TAGS + ['h2', 'h3', 'h4', 'h5', 'h6', 'br', 'p']
  
  
  def clean_for_user_description(html):
      """
      Removes dangerous tags, including h1.
      """
      return bleach.clean(html, tags=USER_DESCR_ALLOWED_TAGS, strip=True)
  
  
  def clean_for_description(html):
      """
      Removes dangerous tags.
      """
      return bleach.clean(html, tags=DESCR_ALLOWED_TAGS, strip=True)
  
  
  def clean_all(html):
      """
      Removes *all* html tags.
      """
      return bleach.clean(html, tags=[], styles=[], attributes=[], strip=True)
  
Allow <br /> and <p> in descriptions
## Code Before:
import bleach


DESCR_ALLOWED_TAGS = bleach.ALLOWED_TAGS + ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']
USER_DESCR_ALLOWED_TAGS = bleach.ALLOWED_TAGS + ['h2', 'h3', 'h4', 'h5', 'h6']


def clean_for_user_description(html):
    """
    Removes dangerous tags, including h1.
    """
    return bleach.clean(html, tags=USER_DESCR_ALLOWED_TAGS, strip=True)


def clean_for_description(html):
    """
    Removes dangerous tags.
    """
    return bleach.clean(html, tags=DESCR_ALLOWED_TAGS, strip=True)


def clean_all(html):
    """
    Removes *all* html tags.
    """
    return bleach.clean(html, tags=[], styles=[], attributes=[], strip=True)

## Instruction:
Allow <br /> and <p> in descriptions
## Code After:
import bleach


DESCR_ALLOWED_TAGS = bleach.ALLOWED_TAGS + ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'br', 'p']
USER_DESCR_ALLOWED_TAGS = bleach.ALLOWED_TAGS + ['h2', 'h3', 'h4', 'h5', 'h6', 'br', 'p']


def clean_for_user_description(html):
    """
    Removes dangerous tags, including h1.
    """
    return bleach.clean(html, tags=USER_DESCR_ALLOWED_TAGS, strip=True)


def clean_for_description(html):
    """
    Removes dangerous tags.
    """
    return bleach.clean(html, tags=DESCR_ALLOWED_TAGS, strip=True)


def clean_all(html):
    """
    Removes *all* html tags.
    """
    return bleach.clean(html, tags=[], styles=[], attributes=[], strip=True)
