Skip to content

Instantly share code, notes, and snippets.

@philwo
Created November 23, 2012 07:14
Show Gist options
  • Save philwo/4134338 to your computer and use it in GitHub Desktop.
Save philwo/4134338 to your computer and use it in GitHub Desktop.
Clover Grappelli Dashboard Configuration
# -*- coding: utf-8 -*-
#
# Copyright 2012 Philipp Wollermann
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from django.utils.translation import ugettext_lazy as _
from grappelli.dashboard import modules, Dashboard
class SortedModelList(modules.ModelList):
def init_with_context(self, context):
super(SortedModelList, self).init_with_context(context)
self.children.sort(key=lambda x: x['title'])
class CloverDashboard(Dashboard):
def init_with_context(self, context):
self.children.append(SortedModelList(
_('Clover'),
column=1,
collapsible=False,
exclude=('django.contrib.*', 'djcelery.*',),
))
self.children.append(SortedModelList(
_('Django Administration'),
column=1,
css_classes=('grp-collapse grp-closed',),
models=('django.contrib.*',),
))
@SalahAdDin
Copy link

heeeeee now i understand better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment