#12879: jquery gets included multiple times
-------------------------------------------+--------------------------------
          Reporter:  mariarchi             |         Owner:  tobias  
            Status:  reopened              |     Milestone:  1.2     
         Component:  django.contrib.admin  |       Version:  1.2-beta
        Resolution:                        |      Keywords:  jquery  
             Stage:  Accepted              |     Has_patch:  0       
        Needs_docs:  0                     |   Needs_tests:  0       
Needs_better_patch:  0                     |  
-------------------------------------------+--------------------------------
Changes (by mariarchi):

  * status:  closed => reopened
  * resolution:  worksforme =>

Comment:

 Ooops, I was wrong, sorry.

 However, if one will do that -
 {{{
 #!python
 class MovieAdmin(admin.ModelAdmin):
     class Media:
         js = ("/media/js/jquery.min.js",
               "media/js/jquery.min.js",
               "media/js/jquery.min.js")
 }}}

 jquery will get included three times. Furthermore, if one codes up a class
 like

 {{{
 #!python
 class MovieAdmin(admin.ModelAdmin):
     class Media:
         js = ("/admin_media/js/jquery.min.js",
               "/admin_media/js/jquery.min.js",
               "/admin_media/js/jquery.min.js")
 }}}

 none of this declarations will make it through, if jquery already got in
 the media object. Or all three will appear, if it wasn't there yet.

 I think that this behavior is both inconsistent and wrong.

 The main use case is that AFAIK the current way of creating pluggable
 admin/form features is to provide mixins. So,
 assuming we have mixins MixinA, MixinB and MixinC then our admin class
 will probably look like

 {{{
 #!python
 class MyAdmin(admin.ModelAdmin, MixinA, MixinB, MixinC):
     class Media:
         js = MixinA.Media.js + MixinB.Media.js + MixinC.Media.js
 }}}

 and guess what happens if all three use jquery.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/12879#comment:5>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to