model_factories.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:flask_jsondash 作者: christabor 项目源码 文件源码
def make_fake_dashboard(name='Random chart', max_charts=10):
    """Generate fake dashboard data with a specific number of random charts.

    Args:
        name (str): The name of the new dashboard (default: {'Random chart'})
        max_charts (int): Max number of charts to make (default: {10})

    Returns:
        dict: The chart configuration.
    """
    charts = ImmutableMultiDict([
        make_fake_chart_data() for _ in range(max_charts)]
    )
    return dict(
        name=name,
        created_by='global',
        date=dt.now(),
        category=choice(settings.CHARTS_CONFIG.keys()),
        modules=db.format_charts(charts),
        id=str(uuid1()),
        layout='freeform',
    )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号