"""
Internal utils
"""


def add_media(dest, media):
    """
    Optimized version of django.forms.Media.__add__() that doesn't create new objects.
    """
    dest.add_css(media._css)
    dest.add_js(media._js)

"""
Internal utils
"""
import django


def add_media(dest, media):
    """
    Optimized version of django.forms.Media.__add__() that doesn't create new objects.

    Only required for Django < 2.0
    """
    if django.VERSION >= (2, 0):
        dest += media
    else:
        dest.add_css(media._css)
        dest.add_js(media._js)

Fix `add_media` util for Django 2.0
Fix `add_media` util for Django 2.0

Neither `add_css` nor `add_js` exist in Django 2.0 because the method
for adding `Media` classes together has changed.

Ref: https://github.com/django/django/commit/c19b56f633e172b3c02094cbe12d28865ee57772
