Fixes issue #346.

In smart manager sink, django orm is used to write to sqlite3 in
autocommit(default) which causes database locking issues when there's a
constant stream of updates in the sink. Use commit_on_success and batch writes
to mitigate this issue.
Dashboard widget query modifications

Change t1 to be the timestamp of the last data point from the previous
dataset, instead of previous t2
Remove commented code
Merge pull request #352 from schakrava/issue#346_database_locked

Fixes  #346.