I don't think of it as "removing" the object... it's more of putting
back what was there before Django's jQuery initialization happened.
> If an admin customization that uses jQuery is loaded, as it should,
> after the contrib.admin's javascript, its `jQuery` object will
> override the django's one, and django will still be able to use jQuery
> with `django.jQuery`.
I like that there is no ambiguity for Django admin javascript writers
on whether they should extend or use window.jQuery or django.jQuery.
> If an admin customization is loaded before the contrib.admin's
> javascript, it *should not* work anyway even if we removed jQuery from
> the global scope. That's because jQuery.noConflict(true) removes the
> jQuery object from the global scope, but doesn't prevent it to be
> created and attached to window (thus overwriting the user's one).
I believe this isn't quite right. If I load my own jQuery (and
plugins that possibly may extend that specific jQuery object) prior to
admin loading its jQuery, the admin's jQuery will move the existing
window.jQuery to a temp variable, load itself, then put the original
object back. Thus we have the original jQuery unaffected and lives in
window.jQuery (along with all its extensions or different version),
and Django's jQuery lives at django.jQuery.
With `jQuery.noConflict(true)` we're not overwriting the `$` or
`jQuery` global objects at all, and keeping our own jQuery self
contained.
> Moreover I wont' be able to use any jQuery plugin (that directly
> references `jQuery`) in the admin (without hacking with
> ModelAdmin._media), because the `jQuery` object does not exist. I am
> forced to include jquery twice ...
This is a good point...
I suppose one could assign Django's jQuery object to the global jQuery
object? I haven't tried it but this might avoid needing to include 2
copies of jQuery if you're ok with the version Django bundles:
<script type="text/javascript">window.jQuery = django.jQuery;</script>
-Rob
Moreover I wont' be able to use any jQuery plugin (that directly
references `jQuery`) in the admin (without hacking with
ModelAdmin._media), because the `jQuery` object does not exist. I am
forced to include jquery twice ...
--
You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to django-d...@googlegroups.com.
To unsubscribe from this group, send email to django-develop...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.