Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

309
Views
In django: Problems with loading jquery with multiple plugins - or: How to load jQuery only once?

I use django (1.8.16) with a ton of plugins ("apps"). Some are:

  • django-ckeditor==4.5.1
  • django-image-cropping==1.0.3
  • django.contrib.admin
  • django-jquery==3.1.0

I want to use django autocomplete-light (dal for short) (3.2.1, current version) in the admin interface. Now I have the following jquery struggle. dal uses jquery but does not load it itself. It leaves it up to the developer. dal comes with a script "select2.js" registering a function under $.select2.

Now the problem. When a plugin like ckeditor or image-cropping loads jquery the function $.select2 is not reachable any more.

I have created a bug report over at dal but one dev says it is my responsability to load jquery first.

So, how do I load jquery, load it before dal needs it and load it only once?

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Per the django-ckeditor docs:

If you have jQuery loaded from a different source just don't set [CKEDITOR_JQUERY_URL] and django-ckeditor will not try to load its own jQuery.

You should make sure you're setting all apps that could load jQuery to not load it, similar to above. Then, use django-jquery to load jquery, making sure that jQuery is available in the console (i.e., try typing console.log($) to see if it's available). Make sure that you put your jQuery template tag above any other template tags loaded by the other libraries.

This should solve any conflicts you're experiencing.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!