check for django.jQuery existence before using it

Replace https://github.com/divio/django-cms/pull/3317 to rebase on develop.