views:

104

answers:

1

Hi. I've been following the Django tutorial, and so far everything's been working as planned.

Except "collapse"ing.

On my admin page, I get the error in 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.

Thanks.

+1  A: 

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.

Eddified
I've been plagued by this problem for months but it's been more of an annoyance than anything since I can work around it by uncollapsing sections in admin.py. Not so for flatpages. It's good to get some confirmation that the problem is not of my own creation but a bug. Thanks!
Jamie
Thanks for your update about this being a problem caused by Ubuntu. I upgraded jQuery using the Debian Squeeze repository (since Ubuntu's latest jQuery is 1.3.2) and everything works as it should now! You've saved me a lot of time and grief. Thank you!
Jamie