Django-cms and jQuery

I have a django site working quite successfully with django-cms, but now I want to include some of my own javascript using jQuery. I am new to django, so my problems may arise because of this.

Django-cms uses jQuery itself, and therefore, if I add jquery to the header, things unsurprisingly break. How to add your own jQuery without affecting django-cms?

At the moment, my javascript files are stored in the root media, which I defined in the projects.py parameters, and, as already mentioned, I refer to them in the header.

As I read this, this seems like a dumb question, but I'm still perplexed.

EDIT :: Some codes

I have the media root installed:

MEDIA_ROOT = os.path.join(PROJECT_PATH, 'media') 

and in my base template the header includes

 <script src="/media/javascript/jquery.js" type="text/javascript"></script> <script src="/media/javascript/application.js" type="text/javascript"></script> 

Javascript in application.js works, but when the django-cms stuff gets up, it breaks. For example, trying to add a plugin to a placeholder results in:

 Uncaught TypeError: Property 'type' of object function ( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' return new jQuery.fn.init( selector, context ); } is not a function 

I assumed that this was because the two jQuery were conflicting

:: OTHER CHANGE :: I should probably add that I use django to host static files only because it is still under development ...

+6
jquery django django-cms
source share
2 answers

A simple solution: keep your jQuery library in the header and put all the other JS in the boottom page, right before the </body> . In this case, in admin mode, your jQuery lib will be overridden by the administrative copy, and then all your code will be added back to it.

+1
source share

Well, the jQuery binding associated with django-cms fixes everything ...

Alas, it uses version 1.3.2, but I think that I will deal with this, and not try and update django-cms.

+2
source share

All Articles