错误:
找不到模块'webpack/schemas/WebpackOptions.json'
我的webpack.config.js看起来像这样 -
var config = {
entry: './main.js',
output: {
path: '/',
filename: 'index.js',
},
devServer: {
inline: true,
port: 8080
},
module: {
loaders: [
{
test: /\.json$/,
loader: 'json'
},
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: ['es2015', 'react']
}
}
]
}
}
module.exports = config;
Run Code Online (Sandbox Code Playgroud) 我在 Django ORM 中的模型是这样的
class Test(Modelbase):
id = models.IntegerField(null=True, blank=True)
amount = models.CharField(max_length=255)
Run Code Online (Sandbox Code Playgroud)
我想添加 id 列表的数量。唯一的问题是金额字段是CharField。如何为金额字段申请金额?
Test.objects.filter(id__in=[1,2,3]).aggregate(Sum('amount'))
Run Code Online (Sandbox Code Playgroud)
我正在Django=1.9.1为此使用。
我有一个带有过滤器和排除的简单查询。排除 Q & Q 不起作用的情况。
以下是我正在使用的查询。
start_date = (datetime(time.localtime().tm_year, time.localtime().tm_mon, 1) - timedelta(1)).replace(day=1)
data = models.Test.objects.filter(
is_deleted=False).exclude(Q(status__in=[1,2,3]) & Q(modified_at__lt=start_date))\
.select_related('created_by')\
.prefetch_related('name')
Run Code Online (Sandbox Code Playgroud)
我希望排除工作。如果我使用两次排除,我就会得到结果。
我有一个文件试图使用 Pandas.read_excel 打开。我收到这样的错误 -
无效文件:
InMemoryUploadedFile:file.xlsx(application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
list1 = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0],
[0, 500000.0, 500000.0, 500000.0], [0, 0, 1000000.0, 0],
[0, 1000000.0, 500000.0, 2500000.0]]
list2 = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0],
[0, 1, 1, 1], [0, 0, 2, 0], [0, 2, 1, 4]]
Run Code Online (Sandbox Code Playgroud)
我们可以从list1和list2中划分每个元素吗?
输出应该再次列在列表中.
django ×2
django-orm ×2
python-3.x ×2
list ×1
node.js ×1
pandas ×1
python ×1
react-native ×1
reactjs ×1
xlrd ×1
xlsx ×1