How to fix "Uncaught TypeError" in collapse.min.js in django-admin?
I've been following the Django tutorial, and so far e开发者_高级运维verything's been working as planned.
Except "collapse"-ing.
On my admin page, I get the error on my Javascript Console:
Uncaught TypeError: Object #<an Object> has no method 'first' collapse.min.js:1
I'm assuming this is a bug in jQuery, or the collapse script. However my question is simply how to fix it, as I've installed the latest libjs-jquery package and collapse.js seems to be Django-created.
This link states that the first() function is only in jquery 1.4 and above: http://api.jquery.com/first/
Looks like a django bug to me. They need to fix it by doing ONE of the following:
- Use jquery 1.4 instead of jquery 1.3.2
- Change collapse.min.js to only use features available in jquery 1.3.2 to achieve the same effect.
The first option may have repercussions throughout the site, though, if jquery 1.4 isn't strictly backward compatible.
Update: for those interested, this is seen in Django 1.2.1 final.
Update: I just re-downloaded a fresh copy of Django-1.2.1, and it appears to be fixed. It is using jquery 1.4.2, so I imagine it should work now (untested).
I'm not sure why I'm seeing this error on my checkout, but at least it has been resolved. :)
Another update: this is due to package management systems. On Ubuntu, the jquery package is separate from django. So the django package has a dependency on the jquery package. However, whoever setup the ubuntu django package appears to have specified that only jQuery 1.3.2 is needed, not version 1.4.2. The bug therefore is in the ubuntu django package, not django itself.
精彩评论