Skip to content

Instantly share code, notes, and snippets.

@vdboor
Created July 28, 2011 21:17
Show Gist options
  • Save vdboor/1112579 to your computer and use it in GitHub Desktop.
Save vdboor/1112579 to your computer and use it in GitHub Desktop.
Example dashboard module
class PersonalModule(modules.LinkList):
title = _('Welcome,')
draggable = False
deletable = False
collapsible = False
template = 'ecms_dashboard/modules/personal.html'
def init_with_context(self, context):
super(PersonalModule, self).init_with_context(context)
current_user = context['request'].user
site_name = get_admin_site_name(context)
# Personalize
self.title = _('Welcome,') + ' ' + (current_user.first_name or current_user.username)
# Expose links
self.pages_link = reverse('%s:ecms_cmsobject_changelist' % site_name)
self.password_link = reverse('%s:password_change' % site_name)
self.logout_link = reverse('%s:logout' % site_name)
def is_empty(self):
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment