I'm not sure about your original problem but prefixing it with django will 
make use of Django's jquery namespace:
https://docs.djangoproject.com/en/dev/ref/contrib/admin/#modeladmin-media-definitions

Django admin Javascript makes use of the jQuery <http://jquery.com/> library. 
> To avoid conflicts with user-supplied scripts or libraries, Django's jQuery 
> is namespaced as django.jQuery. If you want to use jQuery in your own 
> admin JavaScript without including a second copy, you can use the 
> django.jQuery object on changelist and add/edit views.
> If you require the jQuery library to be in the global namespace, for 
> example when using third-party jQuery plugins, or need a newer version of 
> jQuery, you will have to include your own copy of jQuery.


On Friday, January 11, 2013 4:26:19 AM UTC-6, Daniele Procida wrote:
>
> I had a custom widget, which broke after some other things were updated. 
>
> It was saying: 
>
>     TypeError: 'undefined' is not a function (evaluating '$('#id_conta 
>     cts_and_people-phonecontact-content_type-object_id-0-label').combo 
>     box()') 
>
> Last night, I finally managed to fix it, after noticing that this script 
> (which is injected into the HTML body as many times as required for each 
> widget) began: 
>
>     $(document).ready(function(){ 
>
> while others I had seen began: 
>
>     jQuery(document).ready(function($){ 
>
> Changing it to the latter form made it work. 
>
> The only thing is, I don't really understand what was wrong, or how doing 
> that fixed it. 
>
> I understand that a jQuery conflict of some kind meant that jQuery was 
> unable to find the function "combobox()" and that probably this was because 
> of the way the admin template was loading JavaScript files. 
>
> But I don't understand what the changes actually mean, or what they do. 
>
> I also found that: 
>
>     django.jQuery(document).ready(function($){ 
>
> worked. Again, I don't know what that is doing. 
>
> If someone can explain what is going on in this example, that would be 
> really helpful. 
>
> More generally, this sort of thing (jQuery conflicts) seems to be an 
> almost constant issue for Django developers who create custom widgets. Is 
> there a more general strategy for dealing with it? 
>
> Thanks, 
>
> Daniele 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/dd7dlwe4ZJcJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to