예제 #1
0
파일: views.py 프로젝트: tbsschroeder/dbas
def main_admin(request):
    """
    View configuration for the content view. Only logged in user can reach this page.

    :param request: current webservers request
    :return: dictionary with title and project name as well as a value, weather the user is logged in
    """
    LOG.debug("def")
    db_user = request.validated['user']

    ui_locales = get_language_from_cookie(request)
    extras_dict = DictionaryHelper(
        ui_locales).prepare_extras_dict_for_normal_page(
            request.registry, request.application_url, request.path, db_user)
    dashboard_elements = {
        'entities': lib.get_overview(request.path),
        'api_tokens': lib.get_application_tokens()
    }

    return {
        'language': str(ui_locales),
        'title': 'Admin' if db_user.is_admin() else '(B)admin',
        'project': project_name,
        'extras': extras_dict,
        'dashboard': dashboard_elements,
        'discussion': {
            'broke_limit': False
        }
    }
예제 #2
0
 def test_get_overview(self):
     dict_return = admin.get_overview('some_main_page')
     for row in dict_return:
         for category in row:
             for table in category['content']:
                 self.assertIn(table['name'].lower(), admin.table_mapper)
                 self.assertEqual('some_main_page' + table['name'],
                                  table['href'])