我创建了一个TinyMCE插件,需要列表框项来显示html.这是我的插件:
editor.addButton('icons', {
title: 'Foo',
text: 'Foo',
type: 'button',
onclick: function() {
editor.windowManager.open({
title: 'Foo',
width: 300,
height: 200,
body: [{
type: 'listbox',
label: 'Foo',
name: 'foo',
values: [{
title: '<em>Foo</em>', // <-- Mark save. Render as html.
value: 1
}],
}],
});
}
});
Run Code Online (Sandbox Code Playgroud)
另见小提琴:http://jsfiddle.net/allcaps/vqctac3d/
但输出看起来像:
预期:
如何标记列表选项标题保存,以便内容呈现为html?
如何 使用命令行安装旧版本的PhoneGap?
我熟悉以下安装命令:
"$ sudo npm install -g phonegap"
Run Code Online (Sandbox Code Playgroud)
但是,这只安装了最新版本.
从文档:"Django的评论框架已被弃用,不再受支持.大多数用户将更好地使用自定义解决方案或像Disqus这样的托管产品.以前称为django.contrib.comments的代码仍然可用于外部存储库."
移动到django-contrib-comments只是使用django.contrib.comments的现有项目的后备吗?我应该在新项目中使用django-contrib-comments以及为什么(不是)?
MySQL 5.6.4及更高版本扩展了对TIME,DATETIME和TIMESTAMP值的小数秒支持,精度高达微秒(6位):http://dev.mysql.com/doc/refman/5.6/en/fractional-seconds html的
Django 1.5及以上支持小数秒作为imputformat:https://docs.djangoproject.com/en/1.5/ref/settings/#datetime-input-formats
但DATETIME(6)字段尚未在Django中实现. https://code.djangoproject.com/ticket/19716
我决定编写一个自定义的DateTimeFractionField.它是具有DATETIME([1-6])db_type的标准DateTimeField.'precicion'用于设置毫秒,微秒或任何其他分数精度.
class DateTimeFractionField(models.DateTimeField):
description = "Datetimefield with fraction second."
def __init__(self, precision, *args, **kwargs):
self.precision = precision
super(DateTimeFractionField, self).__init__(*args, **kwargs)
def db_type(self, connection):
return 'DATETIME(%s)' % self.precision
class MyModel(models.Model):
dt_micros = DateTimeFractionField(6)
dt_millis = DateTimeFractionField(3)
dt = models.DateTimeField()
def __unicode__(self):
return "%s - %s" %(self.dt_micros, self.dt_millis)
Run Code Online (Sandbox Code Playgroud)
mysql后端负责用0替换毫秒.Django文档建议编写我自己的后端.https://docs.djangoproject.com/en/1.5/ref/settings/#engine
我砍了:
$ cd /path/to/site-packages/django/db/backends/
$ cp -r mysql mysql564
Run Code Online (Sandbox Code Playgroud)
并修改了mysql564/base.py:
42:45行
from django.db.backends.mysql564.client import DatabaseClient
from django.db.backends.mysql564.creation import DatabaseCreation
from …
Run Code Online (Sandbox Code Playgroud) 我正在将Django 1.7与Mezzanine一起使用。我希望在admin中有一些页面,工作人员可以在其中使用按钮和其他控制元素调用某些动作(管理命令等)。
我也想避免创建新模型,或手动创建模板并向其添加链接(如果可能)。
最常见/最干净的方法是什么?
django ×3
django-admin ×2
command-line ×1
cordova ×1
django-1.7 ×1
django-forms ×1
django-orm ×1
installation ×1
listbox ×1
mezzanine ×1
npm ×1
python ×1
tinymce ×1