Пример #1
0
    def test_default_view(self):
        """Test if the default_view() function works as expected."""
        self.assertEqual(utils.default_view(), 'user')
        with override_settings(settings, ADMIN_VIEWS_ORDER=[]):
            reload_settings()
            self.assertEqual(utils.default_view(), None)

        with override_settings(settings, ADMIN_VIEWS_ORDER=['1', '2']):
            reload_settings()
            self.assertEqual(utils.default_view(), None)

        with override_settings(settings, ADMIN_VIEWS_ORDER=['1', 'user', '3']):
            reload_settings()
            self.assertEqual(utils.default_view(), 'user')

        reload_settings()
Пример #2
0
    def test_default_view(self):
        """Test if the default_view() function works as expected."""
        self.assertEqual(utils.default_view(), "user")
        with override_settings(settings, ADMIN_VIEWS_ORDER=[]):
            reload_settings()
            self.assertEqual(utils.default_view(), None)

        with override_settings(settings, ADMIN_VIEWS_ORDER=["1", "2"]):
            reload_settings()
            self.assertEqual(utils.default_view(), None)

        with override_settings(settings, ADMIN_VIEWS_ORDER=["1", "user", "3"]):
            reload_settings()
            self.assertEqual(utils.default_view(), "user")

        reload_settings()
Пример #3
0
    def test_default_view(self):
        """Test if the default_view() function works as expected."""
        self.assertEqual(utils.default_view(), 'user')
        with override_settings(settings, ADMIN_VIEWS_ORDER=[]):
            reload_settings()
            self.assertEqual(utils.default_view(), None)

        with override_settings(settings, ADMIN_VIEWS_ORDER=['1', '2']):
            reload_settings()
            self.assertEqual(utils.default_view(), None)

        with override_settings(settings, ADMIN_VIEWS_ORDER=['1', 'user', '3']):
            reload_settings()
            self.assertEqual(utils.default_view(), 'user')

        reload_settings()
Пример #4
0
def catalog(request, type=default_view()):
    """Admin-Interface generic list view."""
    admin_log(request, type=type)

    mod = get_view_module_or_404(type)
    context = mod.catalog(request)
    context.update(default_dict)
    context.update({'view_type': 'list'})

    template = mod.templates['list']
    return direct_to_template(request, template, extra_context=context)
Пример #5
0
def catalog(request, type=default_view()):
    """Admin-Interface generic list view."""
    admin_log(request, type=type)

    mod = get_view_module_or_404(type)
    context = mod.catalog(request)
    context.update(default_dict)
    context.update({'view_type': 'list'})

    template = mod.templates['list']
    return direct_to_template(request, template, extra_context=context)