Added restriction for dashboards and metrics #2:)

Please, find my comment to commit.
I have already test it and add some instructions for you.
Here you're making this view vulnerable to SQL injection.

Django has an ORM, use it when querying data. Only in some **very** rare cases you actually have to use a raw database cursor.

Instead of this line, `has_restrictions = dashboard.admindashboard_set.exists()` will tell you whether this dashboard has restrictions and `dashboard.admindashboard_set.filter(user=request.user)` gives you the list of permissions for the currently logged-in user.