class Meta: widgets = { 'description_en': RedactorWidget(editor_options={'lang': 'en'}), 'description_zh_cn': RedactorWidget(editor_options={'lang': 'en'}), 'text_en': RedactorWidget(editor_options={'lang': 'en'}), 'text_zh_cn': RedactorWidget(editor_options={'lang': 'en'}), }
class Meta: widgets = { 'long_description_en': RedactorWidget(editor_options={'lang': 'en'}), 'long_description_zh_cn': RedactorWidget(editor_options={'lang': 'en'}) }
class Meta: model = Advantage widgets = { 'section_one': RedactorWidget(editor_options={'lang': 'en'}), 'section_two': RedactorWidget(editor_options={'lang': 'en'}), 'section_three': RedactorWidget(editor_options={'lang': 'en'}), } fields = '__all__' #
class Meta: widgets = { 'detail': RedactorWidget(editor_options={'lang': 'en'}), 'summary': RedactorWidget(editor_options={'lang': 'en'}), 'date': SuitSplitDateTimeWidget, 'start_date': SuitSplitDateTimeWidget, 'end_date': SuitSplitDateTimeWidget, }
class Meta: model = AskTemplate widgets = { 'agreement': RedactorWidget(editor_options={'lang': 'en'}), 'disclaimer': RedactorWidget(editor_options={'lang': 'en'}), 'ask_intro': RedactorWidget(editor_options={'lang': 'en'}), } fields = '__all__' #
def test_RedactorWidget_output(self): widget = RedactorWidget() name = 'body' value = '123' output = widget.render(name, value) self.assertHTMLEqual(output, ( '<textarea cols="40" name="%s" rows="10">%s</textarea><script ' 'type="text/javascript">$("#id_%s").redactor({});</script>' % ( name, value, name)))
def test_RedactorWidget_output_with_editor_options(self): widget = RedactorWidget(editor_options={'iframe': True}) name = 'body' value = '123' output = widget.render(name, value) self.assertHTMLEqual(output, ( '<textarea cols="40" name="%s" rows="10">%s</textarea><script ' 'type="text/javascript">$("#id_%s").redactor({"iframe": ' 'true});</script>' % ( name, value, name)))
def test_RedactorWidget_output_with_editor_options(self): widget = RedactorWidget(editor_options={'iframe': True}) name = 'body' value = '123' output = widget.render(name, value) self.assertHTMLEqual( output, ('<textarea cols="40" name="%s" rows="10">%s</textarea><script ' 'type="text/javascript">$("#id_%s").redactor({"iframe": ' 'true});</script>' % (name, value, name)))
class Meta: widgets = { 'status_description': RedactorWidget( editor_options={ 'lang': 'en', 'buttons': [ 'html', '|', 'formatting', '|', 'bold', 'italic', '|', 'unorderedlist', 'orderedlist', 'outdent', 'indent', 'alignment', 'horizontalrule', 'underline', '|', 'image', '|' ], 'imageUpload': '/clients/redactor/image/', 'toolbarOverflow': True, }), 'todo_description': RedactorWidget( editor_options={ 'lang': 'en', 'buttons': [ 'html', '|', 'formatting', '|', 'bold', 'italic', '|', 'unorderedlist', 'orderedlist', 'outdent', 'indent', 'alignment', 'horizontalrule', 'underline', '|', 'image', '|' ], 'imageUpload': '/clients/redactor/image/', 'toolbarOverflow': True, }), 'amount': NumberInput(attrs={'min': '0'}), 'amount': EnclosedInput(prepend='$'), 'email': EnclosedInput(prepend='icon-envelope'), 'delivered_at': SuitSplitDateTimeWidget, 'brand': Select2Widget(select2_options={'width': '220px'}), 'model': SfWidget(app_name='phone', model_name='model', chain_field='brand', model_field='brand', show_all=False, auto_choose=False, attrs={'class': 'form-control'}, select2_options={"width": "220px"}), }
class Meta: model = Article exclude = ['author', 'slug'] dateTimeOptions = { 'format': 'mm/dd/yyyy HH:ii P', 'autoclose': 'true', 'showMeridian': 'false', } widgets = { 'email_text': RedactorWidget(editor_options={'lang': 'en'}), 'text': RedactorWidget(editor_options={'lang': 'en'}), }
class Meta: widgets = { 'description': RedactorWidget( editor_options={ 'lang': 'en', 'buttons': [ 'html', '|', 'formatting', '|', 'bold', 'italic', '|', 'unorderedlist', 'orderedlist', 'outdent', 'indent', 'alignment', 'horizontalrule', 'underline' ], 'imageUpload': '/clients/redactor/image/' }), 'balance': NumberInput(attrs={'min': '0'}), 'balance': EnclosedInput(prepend='$'), 'location': EnclosedInput(append='icon-map-marker'), 'vat': EnclosedInput(append='%'), 'shop_email': EnclosedInput(prepend='icon-envelope'), 'logo': AdminImageWidget(), }
class Meta: model = Article fields = ('title', 'text', 'email_text', 'author', 'byline', 'tags', 'docfile', 'publish_date', 'is_published', 'send_now', 'broadcast_only', 'add_recipients_only', 'add_recipients') exclude = ['slug'] dateTimeOptions = { 'format': 'mm/dd/yyyy HH:ii P', 'autoclose': 'true', 'showMeridian': 'false', } widgets = { 'publish_date': DateTimeWidget(options=dateTimeOptions), 'email_text': RedactorWidget(editor_options={'lang': 'en'}), 'text': RedactorWidget(editor_options={'lang': 'en'}), }
class WorkReportAdmin(ModelAdmin): # form = DailyReportForm list_display = ('user', 'header', 'create_time') list_display_links = list_display autocomplete_fields = ['user'] list_filter = ['create_time', 'score'] formfield_overrides = { models.TextField: { 'widget': RedactorWidget(editor_options={ 'lang': 'en', 'minHeight': '200' }) } } fieldsets = ( [ None, { 'fields': ('user', 'header', 'create_time', 'report_content'), } ], ['评价', { 'fields': ( 'assess', 'score', ), }], )
def test_RedactorWidget_media(self): widget = RedactorWidget() js_url = static(widget.Media.js[0]) css_url = static(widget.Media.css['all'][0]) self.assertHTMLEqual( str(widget.media), '<link href="%s" media="all" rel="stylesheet" ' 'type="text/css" /><script src="%s" ' 'type="text/javascript" />' % (css_url, js_url))
class Meta: model = Entry widgets = { 'description': RedactorWidget(editor_options={'lang': 'en', 'iframe': 'true', 'css': "/static/enet/css/wysiwyg" ".css"}), }
class Meta: model = Post fields = ('title', 'description', 'slug', 'image', 'content', 'extract', 'category', 'published_at', 'author', 'likes', 'is_active') widgets = { 'content': RedactorWidget(editor_options={ 'lang': 'es', 'minHeight': 400 }), 'extract': RedactorWidget(editor_options={ 'lang': 'es', 'minHeight': 200 }) }
class Meta: widgets = { 'text': RedactorWidget(editor_options={ 'lang': 'es', 'minHeight': '300' }) }
class Meta: model = Version exclude = [] widgets = { 'app': LinkedSelect, 'release_notes': RedactorWidget(editor_options={'lang': 'en', 'minHeight': 150}), 'file_size': widgets.TextInput(attrs=dict(disabled='disabled')), }
def test_RedactorWidget_media(self): widget = RedactorWidget() js_url2 = static(widget.Media.js[0]) js_url1 = static(widget.Media.js[1]) css_url = static(widget.Media.css['all'][0]) media = str(widget.media) self.assertTrue(js_url1 in media) self.assertTrue(js_url2 in media) self.assertTrue(css_url in media)
class Meta: widgets = {'content': RedactorWidget(editor_options={'lang': 'en'})} fields = ( 'page', 'name', 'content', 'background', 'position', 'is_public', )
class Meta: model = Service widgets = { 'statement': Textarea(attrs={ 'cols': 80, 'rows': 30 }), 'description': RedactorWidget(editor_options={'lang': 'en'}), } fields = '__all__' #
class Meta: widgets = { 'descript': RedactorWidget(editor_options={ 'startupFocus': True, 'width': 640, 'height': 400 }), 'exam_notice': RedactorWidget(editor_options={ 'startupFocus': True, 'width': 640, 'height': 400 }), 'result_descript': RedactorWidget(editor_options={ 'startupFocus': True, 'width': 640, 'height': 400 }), }
class Meta: model = FAQ widgets = { 'note': Textarea( attrs={ 'cols': 80, 'rows': 20 } ), #CKEditorWidget(),#AdminWYMEditorArea(),#Textarea(attrs={'class':'ckeedior','cols': 80, 'rows': 30}), 'answer': RedactorWidget(editor_options={'lang': 'en'}), } fields = '__all__' #
class Meta: model = Page widgets = { 'content': RedactorWidget( editor_options={ 'lang': 'en', 'iframe': 'true', 'css': "/static/enet/css/wysiwyg" ".css" }), }
class Meta(object): widgets = { 'email_abertura_caixa': RedactorWidget( editor_options={ 'lang': 'pt_br', 'buttons': ['html', '|', 'formatting', '|', 'bold', 'italic'] }), 'periodo_venc_pedido_compra': NumberInput(attrs={ 'class': 'input-medium', 'placeholder': '0', 'min': '0' }), 'periodo_venc_pedido_venda': NumberInput(attrs={ 'class': 'input-medium', 'placeholder': '0', 'min': '0' }), 'quantidade_inlines_venda': NumberInput(attrs={ 'class': 'input-medium', 'placeholder': '0', 'min': '0' }), 'quantidade_inlines_compra': NumberInput(attrs={ 'class': 'input-medium', 'placeholder': '0', 'min': '0' }), 'intervalo_dias_entrega_venda': NumberInput(attrs={ 'class': 'input-medium', 'placeholder': '0', 'min': '0' }), 'qtde_minima_produtos_em_estoque': NumberInput(attrs={ 'class': 'input-medium', 'placeholder': '0', 'min': '0' }), 'perc_valor_minimo_recebimento': NumberInput(attrs={ 'class': 'input-medium', 'placeholder': '0%', 'min': '0' }), }
class Meta: model = Article fields = ('title', 'text', 'tags', 'docfile', 'ready_for_editor') exclude = [ 'author', 'byline', 'slug', 'publish_date', 'email_text', 'is_published', 'send_now' ] dateTimeOptions = { 'format': 'mm/dd/yyyy HH:ii P', 'autoclose': 'true', 'showMeridian': 'false', } widgets = {'text': RedactorWidget(editor_options={'lang': 'en'})}
class Meta: model = UserProfile password = forms.CharField(label='Password', help_text='') bio = forms.CharField( label='Reporter beats', help_text='What will you focus on in your reporting?') widgets = {'bio': RedactorWidget(editor_options={'lang': 'en'})} fields = ['first_name', 'last_name', 'email', 'phone', 'bio', 'byline'] exclude = [ 'pub_name', 'pub_type', 'user', 'user_type', 'can_publish', 'about', 'last_login', 'date_joined', 'is_staff', 'is_active', 'address', 'city', 'state', 'zipcode', 'pub_area', 'twitter', 'facebook', 'website', 'is_superuser', 'groups', 'user_permissions' ]
class Meta: model = TemplateEmail fields = ('subject', 'sender', 'html_content', 'text_content', 'content_type') widgets = { 'html_content': RedactorWidget(editor_options={ 'buttons': ['html', '|', 'formatting', '|', 'bold', 'italic'] }), 'text_content': AutosizedTextarea(attrs={ 'class': 'span-12', 'rows': 10 }), }
class RegularMeetingAdmin(ModelAdmin): # form = RegularMeetingForm list_display = ('speaker', 'title', 'meeting_time') list_display_links = list_display autocomplete_fields = ['speaker'] list_filter = ['speaker', 'meeting_time'] formfield_overrides = { models.TextField: { 'widget': RedactorWidget(editor_options={ 'lang': 'en', 'minHeight': '200' }) } }
def formfield_for_dbfield(self, db_field, **kwargs): if not 'widget' in kwargs: if db_field.name in ('descripcion'): kwargs['widget'] = RedactorWidget( editor_options=REDACTOR_OPTIONS_SM) elif db_field.name in ('meta_descripcion', ): kwargs['widget'] = AutosizedTextarea( attrs={ 'rows': 3, 'class': 'input-block-level' }) #elif db_field.name in ('tags',): # kwargs['widget'] = Select2TagWidget( # attrs={'data-token-separators': '[","]'}) return super(ModelAdminBase, self).formfield_for_dbfield(db_field, **kwargs)
class Meta: model = Video exclude = ['pk'] widgets = { 'archivo_original': TextInput( attrs={ 'data-fp-apikey': 'Ajx8hpwBjSzWFvcASlVIOz', 'data-fp-button-text': 'Elegir archivo...', 'data-fp-language': 'es', 'type': 'filepicker-dragdrop', 'onchange': '$("button[name=_save]").removeAttr("disabled")' }), 'descripcion': RedactorWidget(editor_options=REDACTOR_OPTIONS_LG), 'fecha_creacion': TextInput(attrs={'class': 'input-small'}), 'metadescripcion': AutosizedTextarea(attrs={ 'rows': 6, 'class': 'input-block-level' }), 'pais': Select2Widget(attrs={ 'data-placeholder': 'Ninguno', 'data-minimumResultsForSearch': 10 }), 'resumen': AutosizedTextarea(attrs={ 'class': 'input-block-level', 'rows': 2 }), 'sprites': AdminImageWidget, #'tags': Select2TagWidget(attrs={'data-token-separators': '[","]'}), 'territorio': Select2Widget( attrs={ 'data-placeholder': 'Ninguno', 'data-minimum-results-for-search': 10 }), 'titulo': TextInput(attrs={'class': 'input-block-level'}), 'usuario_creacion': TextInput(attrs={'class': 'input-small'}), }