Exemplo n.º 1
0
 def formfield(self, **kwargs):
     defaults = {'widget': UEditorWidget(attrs=self.ueditor_settings)}
     defaults.update(kwargs)
     if defaults['widget'] == admin_widgets.AdminTextareaWidget:
         defaults['widget'] = AdminUEditorWidget(
             attrs=self.ueditor_settings)
     return super(UEditorField, self).formfield(**defaults)
Exemplo n.º 2
0
 def __init__(self, label, width=600, height=300, toolbars="full",
              imagePath="", filePath="", upload_settings={},
              settings={}, command=None, event_handler=None, *args,
              **kwargs):
     uSettings = locals().copy()
     del uSettings["self"], uSettings[
         "label"], uSettings["args"], uSettings["kwargs"]
     kwargs["widget"] = UEditorWidget(attrs=uSettings)
     kwargs["label"] = label
     super(UEditorField, self).__init__(*args, **kwargs)
Exemplo n.º 3
0
    def __init__(self, label, width=600, height=300, toolbars="full", imagePath="", filePath="",
                 upload_settings={}, settings={}, command=None, event_handler=None, *args, **kwargs):

        # 一口气把当前所有的局部参数都读取进来
        uSettings = locals().copy()
        del uSettings["self"], uSettings["label"], uSettings["args"], uSettings["kwargs"]

        # FormFiled获取的widget本来可以是db Field传递过来的,但是这里直接忽视了
        # 对应关系: 直接自己指定 Widget
        # XXX: 完成了参数从FormField到Widget的传递
        kwargs["widget"] = UEditorWidget(attrs=uSettings)
        kwargs["label"] = label
        super(UEditorField, self).__init__(*args, **kwargs)
Exemplo n.º 4
0
    def formfield(self, **kwargs):
        defaults = {'widget': UEditorWidget(attrs=self.ueditor_settings)}
        defaults.update(kwargs)
        if defaults['widget'] == admin_widgets.AdminTextareaWidget:
            defaults['widget'] = AdminUEditorWidget(
                attrs=self.ueditor_settings)
        return super(UEditorField, self).formfield(**defaults)

        #以下支持south
        try:
            from south.modelsinspector import add_introspection_rules
            add_introspection_rules([],
                                    ["^DjangoUeditor\.models\.UEditorField"])
        except:
            pass
Exemplo n.º 5
0
 def __init__(self,
              label,
              width=600,
              height=300,
              plugins=(),
              toolbars="normal",
              filePath="",
              imagePath="",
              scrawlPath="",
              imageManagerPath="",
              css="",
              options={},
              *args,
              **kwargs):
     uOptions = MadeUeditorOptions(width, height, plugins, toolbars,
                                   filePath, imagePath, scrawlPath,
                                   imageManagerPath, css, options)
     kwargs["widget"] = UEditorWidget(**uOptions)
     kwargs["label"] = label
     super(UEditorField, self).__init__(*args, **kwargs)
Exemplo n.º 6
0
    def __init__(self,
                 label,
                 width=600,
                 height=300,
                 plugins=(),
                 toolbars=u_settings.DEFAULT_TOOLBARS,
                 file_path='',
                 image_path='',
                 scrawl_path='',
                 image_manager_path='',
                 css='',
                 options={},
                 *args,
                 **kwargs):
        options = make_options(width, height, plugins, toolbars, file_path,
                               image_path, scrawl_path, image_manager_path,
                               css, options)

        kwargs['widget'] = UEditorWidget(**options)
        kwargs['label'] = label

        super(UEditorField, self).__init__(*args, **kwargs)