Commits

Mikhail Korobov committed 6bdb9d6

Add option to disable yui compression for debug purposes

Comments (0)

Files changed (1)

generic_images/admin.py

 
 admin.site.register(AttachedImage)
 
-def attachedimage_form_factory(lang='en'):
+def attachedimage_form_factory(lang='en', debug=False):
     ''' Returns ModelForm class to be used in admin.
         'lang' is the language for GearsUploader (can be 'en' and 'ru' at the
         moment).
     '''
+    yui = '' if debug else '.yui'
     class _AttachedImageAdminForm(forms.ModelForm):
 
         caption = forms.CharField(label=_('Caption'), required=False)
         class Media:
             js = [
                   'generic_images/js/mootools-1.2.4-core-yc.js',
-                  'generic_images/js/GearsUploader.%s.yui.js' % lang,
+                  'generic_images/js/GearsUploader.%s%s.js' % (lang, yui,),
                   'generic_images/js/AttachedImageInline.js',
             ]
 
 ''' Form for AttachedImage model to be used in inline admin '''
 
 
-def attachedimages_inline_factory(lang='en', max_width=''):
+def attachedimages_inline_factory(lang='en', max_width='', debug=False):
     '''  Returns InlineModelAdmin for attached images.
         'lang' is the language for GearsUploader (can be 'en' and 'ru' at the
         moment). 'max_width' is default resize width parameter to be set in
 
     class _AttachedImagesInline(GenericTabularInline):
         model = AttachedImage
-        form = attachedimage_form_factory(lang)
+        form = attachedimage_form_factory(lang, debug)
         template = 'generic_images/attached_images_inline.html'
         max_w = max_width