示例#1
0
    def get(self, request, *args, **kwargs):
        context = self.get_context_data(**kwargs)
        if request.account.is_default_account():
            welcome = quick_read(WELCOME_ANONYMOUS_PATH)
        else:
            welcome = quick_read(WELCOME_REGISTERED_PATH)

        context['welcome'] = welcome

        return self.render_to_response(context)
示例#2
0
文件: views.py 项目: Cloudxtreme/nav
def index(request):
    # Read files that will be displayed on front page
    if request.account.is_default_account():
        welcome = quick_read(WELCOME_ANONYMOUS_PATH)
    else:
        welcome = quick_read(WELCOME_REGISTERED_PATH)

    return direct_to_template(
        request,
        'webfront/index.html',
        {
            'navpath': [('Home', '/')],
            'date_now': datetime.today(),
            'welcome': welcome,
            'navlets': get_navlets(),
            'title': 'Welcome to NAV',
        }
    )
示例#3
0
def index(request, did=None):
    """Controller for main page."""
    # Read files that will be displayed on front page
    if request.account.is_default_account():
        welcome = quick_read(WELCOME_ANONYMOUS_PATH)
    else:
        welcome = quick_read(WELCOME_REGISTERED_PATH)

    dashboard = find_dashboard(request.account, did)
    dashboards = AccountDashboard.objects.filter(account=request.account)

    context = {
        'navpath': [('Home', '/')],
        'date_now': datetime.today(),
        'welcome': welcome,
        'dashboard': dashboard,
        'dashboards': dashboards,
        'navlets': list_navlets(),
        'title': u'NAV - {}'.format(dashboard.name),
    }

    if dashboards.count() > 1:
        dashboard_ids = [d.pk for d in dashboards]
        current_index = dashboard_ids.index(dashboard.pk)
        previous_index = current_index - 1
        next_index = current_index + 1
        if current_index == len(dashboard_ids) - 1:
            next_index = 0
        context.update({
            'previous_dashboard': dashboards.get(pk=dashboard_ids[previous_index]),
            'next_dashboard': dashboards.get(pk=dashboard_ids[next_index])
        })

    return render(
        request,
        'webfront/index.html',
        context
    )
示例#4
0
def footer_info(_request):
    return {'contact_information': quick_read(CONTACT_INFORMATION_PATH)}
示例#5
0
def footer_info(request):
    return {
        'external_links': quick_read(EXTERNAL_LINKS_PATH),
        'contact_information': quick_read(CONTACT_INFORMATION_PATH)
    }
def footer_info(request):
    return {
        'external_links': quick_read(EXTERNAL_LINKS_PATH),
        'contact_information': quick_read(CONTACT_INFORMATION_PATH)
    }