Created
July 28, 2011 21:17
-
-
Save vdboor/1112579 to your computer and use it in GitHub Desktop.
Example dashboard module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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