def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append(modules.LinkList( _('Quick links'), layout='inline', draggable=False, deletable=False, collapsible=False, children=[ [_('Return to site'), '/'], [_('Change password'), reverse('%s:password_change' % site_name)], [_('Log out'), reverse('%s:logout' % site_name)], ] )) # append an app list module for "Applications" self.children.append(modules.AppList( _('Applications'), exclude=('django.contrib.*',), )) # append an app list module for "Administration" self.children.append(modules.AppList( _('Administration'), models=('django.contrib.*',), )) # append a recent actions module self.children.append(modules.RecentActions(_('Recent Actions'), 5)) # append a feed module self.children.append(modules.Feed( _('Latest Django News'), feed_url='http://www.djangoproject.com/rss/weblog/', limit=5 )) # append another link list module for "support". self.children.append(modules.LinkList( _('Support'), children=[ { 'title': _('Django documentation'), 'url': 'http://docs.djangoproject.com/', 'external': True, }, { 'title': _('Django "django-users" mailing list'), 'url': 'http://groups.google.com/group/django-users', 'external': True, }, { 'title': _('Django irc channel'), 'url': 'irc://irc.freenode.net/django', 'external': True, }, ] ))
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" ''' self.children.append(modules.LinkList( _('Quick links'), layout='inline', draggable=False, deletable=False, collapsible=False, children=[ [_('Return to site'), '/'], [_('Change password'), reverse('%s:password_change' % site_name)], [_('Log out'), reverse('%s:logout' % site_name)], ] )) ''' self.children.append(LatestOrders( _(u'Últimos Pedidos'), layout='inline', deletable=False, )) signals.dashboard_index.send(sender=ShopIndexDashboard, dashboard=self)
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append(modules.LinkList( _('Quick links'), layout='inline', draggable=False, deletable=False, collapsible=False, children=[ [_('NAZAJ NA STRAN'), '/'], [_('Urejevalnik besedil'), 'http://ckeditor.com/demo#full'], [_('Spremeni geslo'), reverse('%s:password_change' % site_name)], [_('Odjava'), reverse('%s:logout' % site_name)], ] )) self.children.append(modules.Group( title="UREJANJE SPLETNE STRANI", display="tabs", children=[ modules.ModelList( title='PONUDBE', models=('webpage.models.Exercises',) ), modules.ModelList( title='CENIK', models=('webpage.models.Prices', 'webpage.models.PricingPlan') ), modules.ModelList( title='URNIK', models=('webpage.models.ExercisesWeeklyTimetable', 'webpage.models.NotWorkingHours') ), modules.ModelList( title='NOVICE', models=('webpage.models.News', 'webpage.models.CustomPage') ), modules.ModelList( title='SLIKE', models=('webpage.models.Images', ) ), modules.ModelList( title='POMEMBNA OBVESTILA', models=('webpage.models.InfoBar', ) ), ] )) # append an app list module for "Administration" """ self.children.append(modules.AppList( _('Administration'), models=('django.contrib.*',), )) """ # append a recent actions module self.children.append(modules.RecentActions(_('Recent Actions'), 5))
def init_with_context(self, context): """ Initializes the link list. """ 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 = None self.pages_title = None self.password_link = reverse('{0}:password_change'.format(site_name)) self.logout_link = reverse('{0}:logout'.format(site_name)) if self.cms_page_model: try: app_label, model_name = self.cms_page_model model = get_model(app_label, model_name) pages_title = model._meta.verbose_name_plural.lower() pages_link = reverse('{site}:{app}_{model}_changelist'.format(site=site_name, app=app_label.lower(), model=model_name.lower())) except AttributeError: raise ImproperlyConfigured("The value {0} of FLUENT_DASHBOARD_CMS_PAGE_MODEL setting (or cms_page_model value) does not reffer to an existing model.".format(self.cms_page_model)) except NoReverseMatch: pass else: # Also check if the user has permission to view the module.' if current_user.has_perm('{0}.{1}'.format(model._meta.app_label, model._meta.get_change_permission())): self.pages_title = pages_title self.pages_link = pages_link
def admin_tools_render_menu(context, menu=None): """ Template tag that renders the menu, it takes an optional ``Menu`` instance as unique argument, if not given, the menu will be retrieved with the ``get_admin_menu`` function. """ if menu is None: menu = get_admin_menu() menu.init_with_context(context) has_bookmark_item = False bookmark = None if len([c for c in menu.children if isinstance(c, items.Bookmarks)]) > 0: has_bookmark_item = True url = context['request'].get_full_path() try: bookmark = Bookmark.objects.filter(user=context['request'].user, url=url)[0] except: pass context.update({ 'template': menu.template, 'menu': menu, 'media_url': get_media_url(), 'has_bookmark_item': has_bookmark_item, 'bookmark': bookmark, 'admin_url': reverse('%s:index' % get_admin_site_name(context)), }) return context
def init_with_context(self, context): site_name = get_admin_site_name(context) ver_info = self.get_version_info() self.children.extend([ { 'title': _(u'Доступная версия'), 'value': ver_info.get('last_ver'), 'date': ver_info.get('last_date'), }, { 'title': _(u'Текущая версия'), 'value': ver_info.get('current_state'), }, ]) self.children.extend([ { 'title': item['name'], 'value': item['ver'], 'date': item['date'], } for item in ver_info['current'] ]) self.bottom = [] self.bottom.append({'url': reverse('%s:update_fias_info' % site_name), 'name': u'Проверить доступную версию'}) self.bottom.append({'url': reverse('%s:update_fias' % site_name), 'name': u'Обновить базу ФИАС (долго)'})
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append( ModelAdd(None, model=Story, text='Create new Story')) self.children.append( OwnInstancesList(_('My Stories'), model=Story, key='authors')) self.children.append( modules.AppList(title='Tumblelog', models=('tumblelog.*', ))) self.children.append( modules.LinkList('bookmarklet', children=[{ 'title': 'luminous flux bookmarklet', 'url': generate_bookmarklink(context['request']) }])) self.children.append( modules.AppList(title='Static Content', models=('django.contrib.flatpages.*', ))) self.children.append( CreateForInstance(model=ChangeSuggestion, instances=Story.objects.all(), key='story')) self.children.append( OwnInstancesList(_('My Suggestions'), model=ChangeSuggestion, key='user'))
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append( modules.LinkList( _("Quick links"), layout="inline", draggable=False, deletable=False, collapsible=False, children=[ [_("Return to site"), "/"], [_("Change password"), reverse("%s:password_change" % site_name)], [_("Log out"), reverse("%s:logout" % site_name)], ], ) ) # append an app list module for "Applications" self.children.append(modules.AppList(_("Applications"), exclude=("django.contrib.*",))) # append an app list module for "Administration" self.children.append(modules.AppList(_("Administration"), models=("django.contrib.*",))) # append a recent actions module self.children.append(modules.RecentActions(_("Recent Actions"), 5))
def init_with_context(self, context): site_name = get_admin_site_name(context) # append an app list module for "Administration" self.children.append(modules.ModelList( _('Administration'), models=('django.contrib.*','social_auth.*'), )) # append a recent actions module self.children.append(modules.RecentActions(_('Recent Actions'), 5)) # append another link list module for "support". self.children.append(modules.LinkList( _('Support'), children=[ { 'title': _('Sigurd project website'), 'url': 'http://sigurd.webriders.com.ua', 'external': True, }, { 'title': _('Django Dash 2011'), 'url': 'http://djangodash.com', 'external': True, }, ] ))
def init_with_context(self, context): items = self._visible_models(context['request']) apps = {} for model, perms in items: app_label = model._meta.app_label if app_label not in apps: apps[app_label] = { 'title': capfirst(_(app_label.title())), 'url': reverse('%s:app_list' % get_admin_site_name(context), args=(app_label,)), 'models': [] } model_dict = {} model_dict['title'] = capfirst(model._meta.verbose_name_plural) if perms['change']: model_dict['change_url'] = self._get_admin_change_url(model, context) if perms['add']: model_dict['add_url'] = self._get_admin_add_url(model, context) apps[app_label]['models'].append(model_dict) apps_sorted = apps.keys() apps_sorted.sort() for app in apps_sorted: # sort model list alphabetically apps[app]['models'].sort(lambda x, y: cmp(x['title'], y['title'])) self.children.append(apps[app])
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append(modules.LinkList( _(u'Действия'), layout='inline', draggable=False, deletable=False, collapsible=False, children=[ [_(u'На Сайт'), '/'], [_(u'Изменить пароль'), reverse('%s:password_change' % site_name)], [_(u'Выйти'), reverse('%s:logout' % site_name)], ] )) # append an app list module for "Applications" self.children.append(modules.AppList( _(u'Приложения'), exclude=('django.contrib.*',), )) # append an app list module for "Administration" self.children.append(modules.AppList( _(u'Панель управления'), models=('django.contrib.*',), )) # append a recent actions module self.children.append(modules.RecentActions(_(u'Предыдущие операции'), 10))
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append(modules.LinkList( _('Quick links'), layout='inline', draggable=False, deletable=False, collapsible=False, children=[ [u'Настройки сайта', '/settings/MyApp'], [_('Return to site'), '/'], [_('Change password'), reverse('%s:password_change' % site_name)], [_('Log out'), reverse('%s:logout' % site_name)], ] )) self.children.append( modules.ModelList( title = u'Страницы и Контент', models=( 'menu.models.Menu', 'pages.models.Page', 'gallery.models.Photo', 'news.models.Article', 'programs.models.Program', 'review.models.Review', 'slideshow.models.Slider', 'partners.models.Partner', ), ) ) self.children.append( modules.ModelList( title = u'Заявки и Подписки', models=( 'order.models.Order', 'homeform.models.OrderH', 'subscribe.models.Subscribe', ), ) ) # append a recent actions module self.children.append(modules.RecentActions(_('Recent Actions'), 5)) self.children.append( modules.ModelList( title = u'Пользователи', models=( 'django.contrib.auth.*', 'users.models.Profile', ), ) )
def share(request, id, model, key='users', template='ladmin/share/share_object.html'): from ladmin.admin import UserShareForm # there's a circular reference somewhere. oops. obj = model.objects.get(pk=id) current_shares = getattr(obj, key).all() if not request.user.is_superuser and not request.user in current_shares: raise Http404() share_with = obj.authors.exclude(pk=request.user.pk) done = False if request.POST: form = UserShareForm(request.user, request.POST, initial={'users': share_with}) if form.is_valid(): obj.authors = list(form.cleaned_data['users']) + [request.user] obj.save() done = True else: form = UserShareForm(request.user, initial={'users': share_with}) values = { 'opts': model._meta, 'has_change_permission': True, 'original': obj, 'app_label': model._meta.app_label, 'form': form, 'done': done, } return TemplateResponse(request, template, values, current_app=get_admin_site_name(RequestContext(request)))
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append( modules.LinkList( _('Quick links'), layout='inline', draggable=False, deletable=False, collapsible=False, children=[ [u'Настройки сайта', '/settings/MyApp'], [_('Return to site'), '/'], [ _('Change password'), reverse('%s:password_change' % site_name) ], [_('Log out'), reverse('%s:logout' % site_name)], ])) self.children.append( modules.ModelList( title=u'Страницы', models=('pages.models.Page', ), )) self.children.append( modules.ModelList( title=u'Прайс', models=( 'price.models.Category', 'price.models.SubCategory', 'price.models.Item', ), )) self.children.append( modules.ModelList( title=u'Заказы', models=('order.models.Order', ), )) self.children.append( modules.ModelList( title=u'Обратная связь', models=('feedback.models.Request', ), )) # append a recent actions module self.children.append(modules.RecentActions(_('Recent Actions'), 5)) self.children.append( modules.ModelList( title=u'Пользователи', models=( 'django.contrib.auth.*', 'users.models.Profile', ), ))
def init_with_context(self, context): site_name = get_admin_site_name(context) request = context['request'] self.children += [ modules.ModelList( u'Candidaturas', models=( 'core.models.Pessoa', 'core.models.Candidato', 'core.models.NomePublico', 'core.models.Partido', 'core.models.Coligacao', 'core.models.UE', 'core.models.Candidatura', 'core.models.Votacao', ), ), modules.ModelList( u'Financiamento de Campanha', models=( 'core.models.SetorEconomico', 'core.models.Doador', 'core.models.Doacao', ), ), modules.ModelList( u'Administração', models=('django.contrib.*', ), ), ]
def init_with_context(self, context): site_name = get_admin_site_name(context) # append an app list module for "Applications" self.children.append(modules.AppList( _('Applications'), exclude=('django.contrib.*',), )) # append a link list module for "filebrowser" self.children.append(modules.LinkList( _('FileBrowser'), children=[ [_('FileBrowser'), '/admin/filebrowser/browse/'], ] )) from configuration.views import ConfigModule self.children.append(ConfigModule()) # append a recent actions module self.children.append(modules.RecentActions(_('Recent Actions'), 5)) # append a link list module for "quick links" self.children.append(modules.LinkList( _('Quick links'), layout='inline', children=[ [_('Return to site'), '/'], [_('Change password'), reverse('%s:password_change' % site_name)], [_('Log out'), reverse('%s:logout' % site_name)], ] ))
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append(modules.LinkList( _('Quick links'), layout='inline', draggable=False, deletable=False, collapsible=False, children=[ [_('Add a blog post'), 'zinnia/entry/add/'], [_('Add a lunch menu'), 'lunches/lunchmenu/add/'], [_('Add a newsletter section'), 'newsletter/section/add/'], [_('Return to site'), '/'], [_('Change password'), reverse('%s:password_change' % site_name)], [_('Log out'), reverse('%s:logout' % site_name)], ] )) # append an app list module for "Applications" self.children.append(modules.AppList( _('Applications'), exclude=('django.contrib.*','tagging.*','robots.*','snippet.*','mailchimp.*','cms_filer_image.*'), )) # append a recent actions module self.children.append(modules.RecentActions(_('Recent Actions'), 5)) # append an app list module for "Administration" self.children.append(modules.AppList( _('Administration'), models=('django.contrib.*','tagging.*','robots.*','snippet.*','mailchimp.*','cms_filer_image.*',), ))
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" # self.children.append(modules.LinkList( # _('Quick links'), # layout='inline', # draggable=False, # deletable=False, # collapsible=False, # children=[ # [_('Return to site'), '/'], # [_('Change password'), # reverse('%s:password_change' % site_name)], # [_('Log out'), reverse('%s:logout' % site_name)], # ] # )) # append an app list module for "Applications" self.children.append(modules.AppList( _('Applications'), exclude=('django.contrib.*',), )) # append a recent actions module self.children.append(modules.RecentActions(_('Recent Actions'), 5))
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append(modules.LinkList( _('Quick links'), layout='inline', draggable=False, deletable=False, collapsible=False, children=[ [_('Return to site'), '/'], [_('Change password'), reverse('%s:password_change' % site_name)], [_('Log out'), reverse('%s:logout' % site_name)], ] )) # append an app list module for "Applications" self.children.append(modules.AppList( _('Applications'), exclude=('django.contrib.*',), )) # append an app list module for "Administration" self.children.append(modules.AppList( _('Administration'), models=('django.contrib.*',), )) self.children.append(EmailCounter(title=u"Счетчик сообщений"))
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append(modules.LinkList( _('Quick links'), layout='inline', draggable=True, deletable=True, collapsible=True, children=[ [_('Return to site'), '/'], [_('Change password'), reverse('%s:password_change' % site_name)], [_('Escribir un post'), reverse('admin:blog_entry_add')], [_('Log out'), reverse('%s:logout' % site_name)], ] )) # append an app list module for "Applications" self.children.append(modules.AppList( _('Blogging'), exclude=('django.contrib.*','django_evolution.*'), )) # append an app list module for "Administration" self.children.append(modules.AppList( _('Administration'), models=('django.contrib.*','django_evolution.*',), )) # append a recent actions module self.children.append(modules.RecentActions(_('Recent Actions'), 5))
def init_with_context(self, context): items = self._visible_models(context['request']) apps = {} for model, perms in items: app_label = model._meta.app_label if app_label not in apps: apps[app_label] = { 'title': capfirst(_(app_label.title())), 'url': reverse('%s:app_list' % get_admin_site_name(context), args=(app_label, )), 'models': [] } model_dict = {} model_dict['title'] = capfirst(model._meta.verbose_name_plural) if perms['change']: model_dict['change_url'] = self._get_admin_change_url( model, context) if perms['add']: model_dict['add_url'] = self._get_admin_add_url(model, context) apps[app_label]['models'].append(model_dict) apps_sorted = apps.keys() apps_sorted.sort() for app in apps_sorted: # sort model list alphabetically apps[app]['models'].sort(lambda x, y: cmp(x['title'], y['title'])) self.children.append(apps[app])
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" # self.children.append(modules.LinkList( # _('Quick links'), # layout='inline', # draggable=False, # deletable=False, # collapsible=False, # children=[ # [_('Return to site'), '/'], # [_('Change password'), # reverse('%s:password_change' % site_name)], # [_('Log out'), reverse('%s:logout' % site_name)], # ] # )) # append an app list module for "Applications" self.children.append( modules.AppList( title='Applicationerres', # models=('Work', 'ContactInformation'), models=[ 'works.models.Work', 'contact_information.models.ContactInformation' ], ))
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append(modules.LinkList( _('Quick links'), layout='inline', draggable=True, deletable=False, collapsible=False, children=[ [_('Return to site'), '/'], [_('Change password'), reverse('%s:password_change' % site_name)], [_('Log out'), reverse('%s:logout' % site_name)], ] )) self.children.append( modules.ModelList( title='Продукты', models=[ 'lik.models.Category', 'lik.models.Product' ] ) ) self.children.append( modules.ModelList( title='Настройки сайта', models=[ 'cms.models.*' ] ) )
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append( modules.LinkList(_('Quick links'), layout='inline', children=[ { 'title': u'Выгрузить клиентов в excel', 'url': 'customers/customer/xlsx/', }, ])) # append an app list module for "Applications" self.children.append( modules.AppList( _('Applications'), exclude=('django.contrib.*', ), )) # append an app list module for "Administration" self.children.append( modules.AppList( _('Administration'), models=('django.contrib.*', ), )) # append a recent actions module self.children.append(modules.RecentActions(_('Recent Actions'), 5))
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append(modules.LinkList( _('Quick links'), layout='inline', draggable=False, deletable=False, collapsible=False, children=[ [_('Return to site'), '/'], [_('Change password'), reverse('%s:password_change' % site_name)], [_('See non-approved BikeAnjos'), '/admin/bikeanjo/profile/?approved__exact=0&is_bikeanjo__exact=1'], [_('Matching pendente'), '/admin/bikeanjo/request/?has_bikeanjo=False&status__exact=ONGOING'], [_('Log out'), reverse('%s:logout' % site_name)], ] )) # append an app list module for "Applications" self.children.append(modules.AppList( _('Applications'), exclude=('django.contrib.*',), )) # append an app list module for "Administration" self.children.append(modules.AppList( _('Administration'), models=('django.contrib.*',), )) # append a recent actions module self.children.append(modules.RecentActions(_('Recent Actions'), 5))
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append( modules.LinkList( _('Quick links'), layout='inline', draggable=False, deletable=False, collapsible=False, children=[ [_('List of patiens'), '/cards/card/usercard/'], [_('Add patient'), '/cards/card/usercard/add/'], [_('Log out'), reverse('%s:logout' % site_name)], ])) # Birthday module self.children.append(BirthdayModule(title=_("Birday"), message=u' ')) # Search patients module self.children.append( SearchPatientModule(title=_("Find patient"), message=u' ')) # append an app list module for "Applications" self.children.append( modules.AppList( _('Applications'), exclude=('django.contrib.*', ), )) # append a recent actions module self.children.append(modules.RecentActions(_('Recent Actions'), 5))
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append(modules.LinkList( _('Quick links'), layout='inline', draggable=False, deletable=False, collapsible=False, children=[ [_('List of patiens'), '/cards/card/usercard/'], [_('Add patient'), '/cards/card/usercard/add/'], [_('Log out'), reverse('%s:logout' % site_name)], ] )) # Birthday module self.children.append(BirthdayModule(title=_("Birday"), message = u' ')) # Search patients module self.children.append(SearchPatientModule(title=_("Find patient"), message = u' ')) # append an app list module for "Applications" self.children.append(modules.AppList( _('Applications'), exclude=('django.contrib.*',), )) # append a recent actions module self.children.append(modules.RecentActions(_('Recent Actions'), 5))
def init_with_context(self, context): site_name = get_admin_site_name(context) self.children += [ items.MenuItem(u'Панель управления', reverse('%s:index' % site_name)), items.AppList( u'Приложения', exclude=( 'django.contrib.*', ) ), items.MenuItem(u'Администрирование', children=[ items.MenuItem(u'Группы', '/admin/auth/group/', enabled=context['request'].user.has_perm("auth.change_group")), items.MenuItem(u'Пользователи', '/admin/auth/user/', enabled=context['request'].user.has_perm("auth.change_user")), items.MenuItem(u'Сайты', '/admin/sites/site/', enabled=context['request'].user.has_perm("sites.change_site")), items.MenuItem(u'Настройки', '/admin/configuration/configmodel/', enabled=context['request'].user.has_perm("configuration.change_configmodel")), ], ), items.Bookmarks(), items.MenuItem(u'Система заявок', 'http://web-aspect.ru/helpdesk/'), ]
def admin_tools_render_dashboard(context, location='index', dashboard=None): """ """ if dashboard is None: from settings.admin.dashboard import MonitorIndexDashboard dashboard = MonitorIndexDashboard() dashboard.init_with_context(context) dashboard._prepare_children() try: preferences = DashboardPreferences.objects.get( user=context['request'].user, dashboard_id=dashboard.get_id() ).data except DashboardPreferences.DoesNotExist: preferences = '{}' DashboardPreferences( user=context['request'].user, dashboard_id=dashboard.get_id(), data=preferences ).save() context.update({ 'template': dashboard.template, 'dashboard': dashboard, 'dashboard_preferences': preferences, 'split_at': math.ceil(float(len(dashboard.children))/float(dashboard.columns)), # 'media_url': get_media_url(), 'has_disabled_modules': len([m for m in dashboard.children \ if not m.enabled]) > 0, 'admin_url': reverse('%s:index' % get_admin_site_name(context)), }) return context
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append( modules.LinkList( _("Quick links"), layout="inline", draggable=False, deletable=False, collapsible=False, children=[ [ _("Change password"), reverse("%s:password_change" % site_name) ], [_("Log out"), reverse("%s:logout" % site_name)], ])) self.children.append( modules.ModelList( title=u"Пользователи", models=("core.apps.account.models.TelegramAccount", ), )) self.children.append( modules.ModelList( title=u"Кошельки", models=("core.apps.wallet.models.Wallet", ), )) # append a recent actions module self.children.append(modules.RecentActions(_("Recent Actions"), 5))
def init_with_context(self, context): site_name = get_admin_site_name(context) self.children += [ items.MenuItem('Home', reverse('admin:index')), items.MenuItem(_('Dashboard'), reverse('%s:index' % site_name)), items.Bookmarks(), items.AppList(_('Applications'), exclude=('django.contrib.*', )), items.AppList(_('Administration'), models=('django.contrib.*', )), items.MenuItem( 'Excel Reports', children=[ #items.MenuItem('demographic report', reverse('reports:demographic')), items.MenuItem('demographic report', reverse('reports:demographic')), items.MenuItem('challenges report', reverse('reports:challenges_activity')), items.MenuItem('comments by popularity', reverse('reports:comments_popular')), items.MenuItem('player activity report', reverse('reports:activity_report')), #items.MenuItem('comments by activity 2', reverse('reports:comments_by_activity2')), #items.MenuItem('comments by activity 2 (multi only)', reverse('reports:comments_by_activity2_multi')), ]), ]
def init_with_context(self, context): site_name = get_admin_site_name(context) self.children += [ items.MenuItem(_('Dashboard'), reverse('%s:index' % site_name)), items.AppList(_('Applications'), exclude=('django.contrib.*', )), items.MenuItem( _('Administration'), children=[ items.MenuItem(_('Groups'), '/admin/auth/group/', enabled=context['request'].user.has_perm( "auth.change_group")), items.MenuItem(_('Users'), '/admin/auth/user/', enabled=context['request'].user.has_perm( "auth.change_user")), items.MenuItem(_('Sites'), '/admin/sites/site/', enabled=context['request'].user.has_perm( "sites.change_site")), ], ), items.Bookmarks(), items.MenuItem(_('Google analytics'), 'http://www.google.com/intl/ru/analytics/'), items.MenuItem(_('Helpdesk'), 'http://web-aspect.ru/helpdesk/'), ]
def admin_tools_render_menu(context, menu=None): """ Template tag that renders the menu, it takes an optional ``Menu`` instance as unique argument, if not given, the menu will be retrieved with the ``get_admin_menu`` function. """ if menu is None: menu = get_admin_menu(context) menu.init_with_context(context) has_bookmark_item = False bookmark = None if len([c for c in menu.children if isinstance(c, items.Bookmarks)]) > 0: has_bookmark_item = True url = context['request'].get_full_path() try: bookmark = Bookmark.objects.filter(user=context['request'].user, url=url)[0] except: pass context.update({ 'template': menu.template, 'menu': menu, 'has_bookmark_item': has_bookmark_item, 'bookmark': bookmark, 'admin_url': reverse('%s:index' % get_admin_site_name(context)), }) return context
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append(GithubCrawlerDashboardModule(_('Github crawler'))) self.children.append(modules.LinkList( _('Quick links'), layout='inline', draggable=False, deletable=False, collapsible=False, children=[ [_('Return to site'), '/'], [_('Change password'), reverse('%s:password_change' % site_name)], [_('Log out'), reverse('%s:logout' % site_name)], ] )) # append an app list module for "Applications" self.children.append(modules.AppList( _('Applications'), exclude=('django.contrib.*',), )) # append an app list module for "Administration" self.children.append(modules.AppList( _('Administration'), models=('django.contrib.*',), )) # append a recent actions module self.children.append(modules.RecentActions(_('Recent Actions'), 5))
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append( modules.LinkList( _("Quick links"), layout="inline", draggable=False, deletable=False, collapsible=False, children=[ [ _("Change password"), reverse("%s:password_change" % site_name) ], [_("Log out"), reverse("%s:logout" % site_name)], ], )) # append an app list module for "Applications" self.children.append( modules.AppList(_("Applications"), exclude=("django.contrib.*", ))) # append a recent actions module self.children.append(modules.RecentActions(_("Recent Actions"), 5))
def init_with_context(self, context): site_name = get_admin_site_name(context) ver_info = self.get_version_info() self.children.extend([ { 'title': _(u'Доступная версия'), 'value': ver_info.get('last_ver'), 'date': ver_info.get('last_date'), }, { 'title': _(u'Текущая версия'), 'value': ver_info.get('current_state'), }, ]) self.children.extend([{ 'title': item['name'], 'value': item['ver'], 'date': item['date'], } for item in ver_info['current']]) self.bottom = [] self.bottom.append({ 'url': reverse('%s:update_fias_info' % site_name), 'name': u'Проверить доступную версию' }) self.bottom.append({ 'url': reverse('%s:update_fias' % site_name), 'name': u'Обновить базу ФИАС (долго)' })
def init_with_context(self, context): """ Initializes the link list. """ 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 = None self.pages_title = None self.password_link = reverse('%s:password_change' % site_name) self.logout_link = reverse('%s:logout' % site_name) if self.cms_page_model: try: app_label, model_name = self.cms_page_model model = get_model(app_label, model_name) self.pages_title = model._meta.verbose_name_plural.lower() self.pages_link = reverse('{site}:{app}_{model}_changelist'.format(site=site_name, app=app_label.lower(), model=model_name.lower())) except AttributeError: raise ImproperlyConfigured("The value {0} of FLUENT_DASHBOARD_CMS_PAGE_MODEL setting (or cms_page_model value) does not reffer to an existing model.".format(self.cms_page_model)) except NoReverseMatch: pass
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" #self.children.append(modules.LinkList( # _('Quick links'), # layout='inline', # draggable=False, # deletable=False, # collapsible=False, # children=[ # [_('Return to site'), '/'], # [_('Change password'), # reverse('%s:password_change' % site_name)], # [_('Log out'), reverse('%s:logout' % site_name)], # ] #)) # append an app list module for "Applications" self.children.append(modules.AppList( _('Applications'), exclude=('django.contrib.*',), )) # append an app list module for "Administration" self.children.append(modules.AppList( _('Administration'), models=('django.contrib.*',), ))
def init_with_context(self, context): site_name = get_admin_site_name(context) self.children += [ items.MenuItem(_('Return to site'), '/'), items.MenuItem(_('Dashboard'), reverse('%s:index' % site_name)), items.AppList( 'Medical Records', models=( 'uhai.records.*','uhai.medication.*', 'uhai.patients.*', ), ), items.AppList( 'Patient / Employee Programs', models=('uhai.questions.*', 'uhai.programs.*',), ), items.AppList( 'Providers', models=('uhai.providers.*',), ), items.AppList( 'Insurance Administration', models=('uhai.insurance.*',), ), items.AppList( 'Administration', exclude=( 'uhai.questions.*','uhai.records.*', 'uhai.programs.*', 'uhai.insurance.*', 'uhai.medication.*', 'uhai.patients.*', 'uhai.providers.*' ), ), ]
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append(modules.LinkList( _('Quick links'), layout='inline', draggable=False, deletable=False, collapsible=False, children=[ [_('Return to site'), '/'], [_('Change password'), reverse('%s:password_change' % site_name)], [_('Log out'), reverse('%s:logout' % site_name)], ] )) # append an app list module for "Applications" self.children.append(modules.ModelList( _('Users and groups'), models=('authentic2.models.User', 'django.contrib.auth.models.*'), )) self.children.append(modules.ModelList( _('Services'), models=( 'authentic2.saml.models.LibertyProvider', 'authentic2.saml.models.SPOptionsIdPPolicy', 'authentic2.saml.models.IdPOptionsSPPolicy', 'authentic2.idp.models.AttributePolicy', 'authentic2.attribute_aggregator.models.AttributeList', 'authentic2.attribute_aggregator.models.AttributeItem', 'authentic2.attribute_aggregator.models.AttributeSource', ), )) # append a recent actions module self.children.append(modules.RecentActions(_('Recent Actions'), 5)) # append another link list module for "support". self.children.append(modules.LinkList( _('Support'), children=[ { 'title': _('Authentic2 documentation'), 'url': 'http://pythonhosted.org/authentic2/', 'external': True, }, { 'title': _('Authentic2 project'), 'url': 'http://dev.entrouvert.org/projects/authentic/', 'external': True, }, { 'title': _('Authentic Mailing List'), 'url': 'http://listes.entrouvert.com/info/authentic', 'external': True, }, ] ))
def init_with_context(self, context): site_name = get_admin_site_name(context) # append an app list module for "Administration" self.children.append( modules.ModelList( _('Administration'), models=('django.contrib.*', 'social_auth.*'), )) # append a recent actions module self.children.append(modules.RecentActions(_('Recent Actions'), 5)) # append another link list module for "support". self.children.append( modules.LinkList(_('Support'), children=[ { 'title': _('Sigurd project website'), 'url': 'http://sigurd.webriders.com.ua', 'external': True, }, { 'title': _('Django Dash 2011'), 'url': 'http://djangodash.com', 'external': True, }, ]))
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a iellos frame self.children.append(modules.Html( _('Mais visitados'), children=grafico() ))
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append(modules.LinkList( _('Kom igång!'), layout='inline', draggable=False, deletable=False, collapsible=False, children=[ [_('Lägg till ett område'), reverse("admin:django_api_area_add")], [_('Ändra ett redan tillagt område'), reverse("admin:django_api_area_changelist")], ] )) self.children.append(modules.LinkList( _('Övrigt'), layout='inline', draggable=False, deletable=False, collapsible=False, children=[ [_('Return to site'), '/'], [_('Change password'), reverse('%s:password_change' % site_name)], [_('Log out'), reverse('%s:logout' % site_name)], ] ))
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append(modules.LinkList( _('Quick links'), layout='inline', draggable=False, deletable=False, collapsible=False, children=[ [_("Gestion des Expositions"), "manage/expositions/"], [_('Return to site'), '/'], [_('Change password'), reverse('%s:password_change' % site_name)], [_('Log out'), reverse('%s:logout' % site_name)], ] )) # append an app list module for "Applications" self.children.append(modules.AppList( _('Gestionnaire du contenu'), draggable=False, deletable=False, collapsible=False, exclude=('django.contrib.*',), )) # append an app list module for "Administration" self.children.append(modules.AppList( _('Gestion utilisateurs'), draggable=False, deletable=False, models=('django.contrib.*',), )) # append a recent actions module self.children.append(modules.RecentActions( _('Recent Actions'), 5, draggable=False, deletable=False, )) # append an alerts of delivery artworks self.children.append(modules.Group( title = _('Alertes'), display = 'stacked', draggable=False, deletable=False, children=[ modules.LinkList( title = 'Livraisons', children = self.get_alerts(), ), modules.LinkList( title = 'Taches', children = self.get_tasks(context), ), ] ))
def init_with_context(self, context): site_name = get_admin_site_name(context) # append an app list module for "Applications" self.children.append(modules.AppList( _(u'Администрирование'), exclude=('django.contrib.*',), ))
def init_with_context(self, context): print 'key is', self.key for child in self.instances: self.children.append({ 'title': child, 'create_url': reverse('%s:%s_%s_add' % (get_admin_site_name(context), self.model._meta.app_label, self.model.__name__.lower(),))+'?'+self.key+'='+str(child.pk) }) self._initialized = True
def init_with_context(self, context): site_name = get_admin_site_name(context) self.children.append(modules.ModelList( title="Каталог", models=[ 'catalog.models.Category', 'catalog.models.Item', ] )) self.children.append(modules.ModelList( title="Платные услуги", models=[ 'tariff.models.Tariff', 'order.models.Order', ] )) self.children.append(modules.ModelList( title="Контент", models=[ 'superbanner.models.SuperBanner', 'articles.models.Article', 'help.models.Help', 'extendflatpages.models.ExtendFlatpage' ] )) self.children.append(modules.Group( title="Администрирование сайта", display="tabs", children=[ modules.ModelList( title="Пользователи", models=[ 'user.models.MarketplaceUser', 'shops.models.Shop', ] ), modules.ModelList( title="Справочники", models=[ 'dictionary.models.Region', 'dictionary.models.Color', 'dictionary.models.SizeSet', ] ), modules.AppList( title='Все приложения', # exclude=('django.contrib.*',) ) ] )) self.children.append(FeedbackDashboardModule()) self.children.append(BalanceLogDashboardModule())
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append( modules.LinkList( _('Quick links'), layout='inline', draggable=False, deletable=False, collapsible=False, children=[ [_('Return to site'), '/'], [ _('Change password'), reverse('%s:password_change' % site_name) ], [_('Log out'), reverse('%s:logout' % site_name)], ])) # append an app list module for "Applications" self.children.append( modules.AppList( _('Applications'), exclude=('django.contrib.*', ), )) # append an app list module for "Administration" self.children.append( modules.AppList( _('Administration'), models=('django.contrib.*', ), )) # append another link list module for "support". self.children.append( modules.LinkList(_('Results'), children=[{ 'title': _('Results'), 'url': reverse('survey_list'), 'external': False, }])) from surveys.utils import get_last_survey survey = get_last_survey() self.children.append( TableDashboard(title='Last Survey Top Questions', children=survey.top_questions, headers=[ 'Plulication Date', 'Code', 'Question', 'Total Count' ], fields=[ 'pub_date', 'slug', 'question_text', 'user_choices_count' ])) self.children.append( ChartDashboard(title='Survey Chart', chart_id=1, childrens=[]))
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append(modules.LinkList( _('Quick links'), layout='inline', draggable=False, deletable=False, collapsible=False, children=[ [u'Настройки сайта', '/settings/MyApp'], [_('Return to site'), '/'], [_('Change password'), reverse('%s:password_change' % site_name)], [_('Log out'), reverse('%s:logout' % site_name)], ] )) self.children.append( modules.ModelList( title = u'Контент', models=( 'pages.models.Page', 'jury.models.Jury', 'partners.models.Partner', 'news.models.Article', 'seminars.models.Seminar', ), ) ) self.children.append( modules.ModelList( title = u'Пользователи', models=( 'users.models.Expert', 'users.models.Participant', 'django.contrib.auth.*', 'feedback.models.Feedback' ), ) ) self.children.append( modules.ModelList( title = u'Проекты', models=( 'projects.models.Nomination', 'projects.models.Project', ), ) ) # append a recent actions module self.children.append(modules.RecentActions(_('Recent Actions'), 5))
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append(modules.LinkList( _('Quick links'), layout='inline', draggable=False, deletable=False, collapsible=False, children=[ [u'Настройки сайта', '/settings/MyApp'], [_('Return to site'), '/'], [_('Change password'), reverse('%s:password_change' % site_name)], [_('Log out'), reverse('%s:logout' % site_name)], ] )) self.children.append( modules.ModelList( title = u'Страницы и Контент', models=( 'pages.models.Page', 'news.models.Article', 'slideshow.models.Slider', 'review.models.Review', 'contacts.models.Employee', 'certificates.models.Certificate', 'partners.models.Partner', ), ) ) self.children.append( modules.ModelList( title = u'Заявки и Подписки', models=( 'feedback.models.Feedback', 'request.models.Request', ), ) ) # append a recent actions module self.children.append(modules.RecentActions(_('Recent Actions'), 5)) self.children.append( modules.ModelList( title = u'Пользователи', models=( 'django.contrib.auth.*', 'users.models.Profile', ), ) )
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append( modules.LinkList( _('Quick Links'), layout='inline', # draggable=False, deletable=False, # collapsible=False, children=[ [_('Return to site'), '/'], [ _('Change password'), reverse('%s:password_change' % site_name) ], [_('Log out'), reverse('%s:logout' % site_name)], ])) # append an app list module for "Content" self.children.append( modules.AppList( _('Content'), models=itemlist_content, )) # append an app list module for "Miscellaneous" self.children.append( modules.AppList( _('Miscellaneous'), exclude=itemlist_misc_exclude, )) # append an app list module for "Structure" self.children.append( modules.AppList( _('Site Structure'), models=itemlist_structure, )) # append an app list module for "SL" self.children.append( modules.AppList( _('Second Life Systems'), models=itemlist_sl, )) # append an app list module for "System Management" self.children.append( modules.AppList( _('System Management'), models=itemlist_system, )) # append a recent actions module self.children.append(modules.RecentActions(_('Recent Actions'), 10))
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append( modules.LinkList( _('Quick links'), layout='inline', draggable=False, deletable=False, collapsible=False, children=[ [u'Настройки сайта', '/settings/MyApp'], [_('Return to site'), '/'], [ _('Change password'), reverse('%s:password_change' % site_name) ], [_('Log out'), reverse('%s:logout' % site_name)], ])) self.children.append( modules.ModelList( title=u'Страницы и Контент', models=( 'menu.models.Menu', 'pages.models.Page', 'gallery.models.Photo', 'news.models.Article', 'programs.models.Program', 'review.models.Review', 'slideshow.models.Slider', 'partners.models.Partner', ), )) self.children.append( modules.ModelList( title=u'Заявки и Подписки', models=( 'order.models.Order', 'homeform.models.OrderH', 'subscribe.models.Subscribe', ), )) # append a recent actions module self.children.append(modules.RecentActions(_('Recent Actions'), 5)) self.children.append( modules.ModelList( title=u'Пользователи', models=( 'django.contrib.auth.*', 'users.models.Profile', ), ))
def init_with_context(self, context): site_name = get_admin_site_name(context) self.children += [ items.MenuItem(_('Dashboard'), reverse('{0}:index'.format(site_name))), items.Bookmarks(), ] for title, kwargs in get_application_groups(): self.children.append(ModelList(title, **kwargs)) self.children.append(ReturnToSiteItem())
def init_with_context(self, context): site_name = get_admin_site_name(context) self.children += [ items.MenuItem(_('Dashboard'), reverse('%s:index' % site_name)), items.Bookmarks(), items.AppList(_('Applications'), exclude=('django.contrib.*', )), items.AppList(_('Administration'), models=('django.contrib.*', )) ]
def init_with_context(self, context): self.title = '1997 站点管理' site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append( modules.LinkList( _('快速链接'), layout='inline', draggable=True, deletable=False, collapsible=False, children=[ [_('返回站点首页'), '/'], [_('修改密码'), reverse('%s:password_change' % site_name)], [_('注销'), reverse('%s:logout' % site_name)], ])) # append an app list module for "Applications" self.children.append( modules.AppList( _('应用'), exclude=('django.contrib.*', ), )) # append an app list module for "Administration" self.children.append( modules.AppList( _('管理员设置'), models=('django.contrib.*', ), )) # append a recent actions module self.children.append(modules.RecentActions(_('近期操作'), 5)) # append a feed module # self.children.append(modules.Feed( # _('Latest Django News'), # feed_url='http://www.djangoproject.com/rss/weblog/', # limit=5 # )) # append another link list module for "support". self.children.append( modules.LinkList(_('其他管理页面'), children=[ { 'title': _('预约管理'), 'url': '/admin/r', 'external': True, }, { 'title': _('教师时段管理'), 'url': '/admin/t', 'external': True, }, ]))
def init_with_context(self, context): site_name = get_admin_site_name(context) self.children += [ modules.ModelList( u'Portal', models=('raizcidadanista.cms.models.Section', 'raizcidadanista.cms.models.Article', 'raizcidadanista.cms.models.ArticleComment', 'raizcidadanista.cms.models.Menu', 'raizcidadanista.cms.models.URLMigrate', 'raizcidadanista.cms.models.FileDownload', ), ), modules.ModelList( u'Cadastro', models=('cadastro.models.*', ), exclude=('cadastro.models.ListaCadastro', ), ), modules.ModelList( u'Municípios', [ 'municipios.models.*', ] ), modules.ModelList( u'Fórum', [ 'forum.models.*', ] ), modules.ModelList( u'Financeiro', [ 'financeiro.models.*', ] ), modules.ModelList( u'Configurações', models=('raizcidadanista.cms.models.Recurso', 'raizcidadanista.cms.models.Theme', ), extra=[ {'title': u'Visualizador de Arquivos', 'add_url': reverse('filebrowser:fb_upload'), 'change_url': reverse('filebrowser:fb_browse')}, ] ), modules.ModelList( u'Administração', models=('django.contrib.*', 'utils.models.*', 'raizcidadanista.cms.models.EmailAgendado', ), exclude=('django.contrib.sites.models.*', ), ), modules.LinkList( u'Links Rápidos', layout='inline', draggable=True, deletable=True, collapsible=True, children=[ [u'Portal', '/'], [u'Sugerir Artigo', reverse('admin:cms_article_add_power')], [u'Alterar Senha', reverse('admin:password_change')], [u'Reset Menu', reverse('admin:reset_dashboard')], [u'Sair', reverse('admin:logout')], ] ), modules.RecentActions(u'Últimas mudanças', 5), ]
def init_with_context(self, context): self.title = None self.children = [] self.children.append({ 'title': self.text, 'add_url': reverse('%s:%s_%s_add' % (get_admin_site_name(context), self.model._meta.app_label, self.model.__name__.lower(),)) }) self._initialized = True
def init_with_context(self, context): site_name = get_admin_site_name(context) # append a link list module for "quick links" self.children.append( modules.LinkList( _('Quick links'), layout='inline', draggable=False, deletable=False, collapsible=False, children=[ [_('Return to site'), '/'], [_('Documentation'), settings.API_DOCS_URL], [ _('Change password'), reverse('%s:password_change' % site_name) ], [_('Log out'), reverse('%s:logout' % site_name)], ])) self.children.append( modules.ModelList(title=_('Autenticación'), models=[ 'rest_framework.authtoken.*', 'oauth2_provider.*', 'auths.models.*', 'apps.credentials.models.PlatformApp', ])) self.children.append( modules.ModelList(title=_('Redes Sociales'), models=[ 'social.apps.django_app.*', 'allauth.socialaccount.*', ])) self.children.append( modules.ModelList(title=_('Plataforma'), models=[ 'django.contrib.sites.*', 'constance.*', ])) self.children.append( modules.ModelList(title=_('Administration'), models=[ 'django.contrib.auth.*', 'allauth.account.*', 'apps.users.models.*', ])) # append a recent actions module self.children.append(modules.RecentActions(_('Recent Actions'), 5))