Added restriction for dashboards and metrics #2:)

Please, find my comment to commit.
I have already test it and add some instructions for you.
That error message will be confusing and make things hard to debug if an exception actually happens here. If you don't know what to expect, don't wrap your code in a `try… except`. The view will crash with a proper traceback and this will give much more information for debugging.

Also, `except:` clauses need to specify the type of exception. A bare `except:` like this catches `SystemExit`, `KeyboardInterrupt` which usually are things you don't want to catch silently. You need to be specific or remove the try… except.