Source Code for Me (

Allows you to paste souce code to blogs! Adapted for Twitter! Here is Search Form in case you missed your code.
Tags: Python,WysiwygAdmin,Meta,formfield_for_dbfield,Media, Created At: 10/24/2016 8:20:48 PMViews:

HTML view:
Copy Source | Copy HTML
class WysiwygAdmin(admin.ModelAdmin):
    class Meta:
        # Ð¡Ð¿Ð¸ÑÐ¾Ðº Ð¿Ð¾Ð»ÐµÐ¹ Ð´Ð»Ñ ÐºÐ¾Ñ‚орых Ð½ÑƒÐ¶Ð½Ð¾ Ð²ÐºÐ»ÑŽÑ‡Ð¸Ñ‚ÑŒ Ð²Ð¸Ð·ÑƒÐ°Ð»ÑŒÐ½Ñ‹Ð¹ Ñ€ÐµÐ´Ð°ÐºÑ‚ор    
        wysiwyg_fields = ()
    # Ð”обавляем ÐºÐ»Ð°ÑÑ wysiwyg Ð´Ð»Ñ Ð²ÑÐµÑ… Ð¿Ð¾Ð»ÐµÐ¹ Ð¿ÐµÑ€ÐµÑ‡Ð¸ÑÐ»ÐµÐ½Ð½Ñ‹Ñ… Ð² Meta.wysiwyg_fields
    def formfield_for_dbfield(self, db_field, **kwargs):
        field = super(WysiwygAdmin, self).formfield_for_dbfield(db_field, **kwargs)
        if in self.Meta.wysiwyg_fields:
            field.widget.attrs['class'] = 'wysiwyg ' + field.widget.attrs.get('class', '')
        return field
    # ÐŸÐ¾Ð´ÐºÐ»ÑŽÑ‡ÐµÐ½Ð¸Ðµ js/css
    class Media:
        js = ('',
              settings.MEDIA_URL + 'js/wymeditor/jquery.wymeditor.pack.js',
              settings.MEDIA_URL + 'js/wysiwyg.js',)
        css = {'screen': (settings.MEDIA_URL + 'js/wymeditor/skins/default/screen.css',)}

Based on Manoli.Net's CodeFormatter. Made by Topbot (c) 2008-2017