Paul's Programming Notes     Archive     Feed     Github

AttributeError: 'dict' object has no attribute '_set_parent_with_dispatch' - SQLalchemy



The documentation says: "Keyword arguments can be specified by specifying the last argument as a dictionary"

So you will need to change this:
__table_args__ = (
{'sqlite_autoincrement': True},
            UniqueConstraint('filename', 'path')
            )

to this:
__table_args__ = (
            UniqueConstraint('filename', 'path'),
            {'sqlite_autoincrement': True}

            )

jPanelMenu Causing Document.Ready() To Run Twice

This line in jquery.jpanelmenu.js is the cause:
$('body > *').not(jP.menu + ', ' + jP.options.excludedPanelContent).wrapAll('<div class="' + 'jPanelMenu-panel' + '"/>');

You will need to comment it out and wrap everything in your body tag manually with:
<div class="jPanelMenu-panel" style="position: relative; left: 0px;">
</div>

The end result will look like:
<body>
<div class="jPanelMenu-panel" style="position: relative; left: 0px;">
all your code....
</div>
</body>


This page helped me figure it out: http://doctype.com/trying-jquery-wrapall-seems-wrap-content-twice

Yii Google Chart Extension

Here's YiiWheel's google chart wrapper extension: https://github.com/2amigos/yiiwheels/blob/master/widgets/google/WhVisualizationChart.php

I downloaded just the WhVisualizationChart file and put this in my view:

$this->widget('ext.WhVisualizationChart', array(
    'visualization' => 'PieChart',
    'data' => $chartDataProvider,
    'options' => array(
        'pieHole'=> '0.5',
        'backgroundColor'=>array('fill'=>'transparent'),
    ),
    'htmlOptions'=>array('style'=>'width:100%; height:375px'),
));

and this in my controller:

public function actionIndex()
{
        $chartDataProvider = array(
            array('Task', 'Hours per Day'),
            array('Work', 11),
            array('Eat', 2),
            array('Commute', 2),
            array('Watch TV', 2),
            array('Sleep', 7)
        );
$this->render('index', array('chartDataProvider'=>$chartDataProvider));
}

Examples on how to use it are at the bottom of this page: http://yiiwheels.2amigos.us/site/charts#visualizationchart