コード例 #1
0
ファイル: models.py プロジェクト: magopian/ulysse
    def get_menu(self, request):
        from competitions import admin_site

        nav_buttons = []
        if admin_site.is_competition_admin(request) or request.user.is_superuser:
            nav_buttons.append(get_nav_button(request, "infos/", _(u"Informations")))
            nav_buttons.append(get_nav_button(request, "news/", _(u"News")))
            nav_buttons.append(get_nav_button(request, "candidates/", _(u"Candidates")))
            nav_buttons.append(get_nav_button(request, "jury_members/", _(u"Jury member")))
            # Add steps dynamically
            for step in self.steps():
                step_button = get_nav_button(request, "step/%s" % step.url, _(u"'%s' step" % step.name))
                children = []
                children.append(
                    get_nav_button(request, "step/%s/importation/" % step.url, _(u"1 - Import new candidates"))
                )
                children.append(
                    get_nav_button(request, "step/%s/allocations/" % step.url, _(u"2 - Manage candidates/jury"))
                )
                children.append(
                    get_nav_button(request, "step/%s/notifications/" % step.url, _(u"3 - Notify jury members"))
                )
                children.append(
                    get_nav_button(request, "step/%s/evaluations/" % step.url, _(u"4 - Follow evaluations"))
                )
                children.append(get_nav_button(request, "step/%s/results/" % step.url, _(u"5 - Follow results")))
                step_button["children"] = children
                nav_buttons.append(step_button)
        if admin_site.is_jury_member(request):  # jury members only have a limited admin
            nav_buttons.append(get_nav_button(request, "evaluate/", _(u"To evaluate")))
        return nav_buttons
コード例 #2
0
ファイル: context_processors.py プロジェクト: magopian/ulysse
def ulysse_context_processor(request):        
    results = {}
    results["in_competition_admin"]  = in_competition_admin(request)
    results["is_user_authenticated"] = request.user.is_authenticated()
    from competitions import admin_site
    competition = admin_site.get_active_competition(request)
    if competition:
        results["active_competition"]       = competition
        results["active_competition_step"]  = admin_site.get_active_competition_step(request)
        results["admin_title"]              = _("Administrate competition \"%s\"") % competition
        results["nav_buttons"]              = competition.get_menu(request)        
    results["jury_member"] = admin_site.is_jury_member(request)
    return results
コード例 #3
0
def ulysse_context_processor(request):
    results = {}
    results["in_competition_admin"] = in_competition_admin(request)
    results["is_user_authenticated"] = request.user.is_authenticated()
    from competitions import admin_site
    competition = admin_site.get_active_competition(request)
    if competition:
        results["active_competition"] = competition
        results[
            "active_competition_step"] = admin_site.get_active_competition_step(
                request)
        results["admin_title"] = _(
            "Administrate competition \"%s\"") % competition
        results["nav_buttons"] = competition.get_menu(request)
    results["jury_member"] = admin_site.is_jury_member(request)
    return results
コード例 #4
0
 def get_menu(self, request):
     from competitions import admin_site
     nav_buttons = []
     if admin_site.is_competition_admin(
             request) or request.user.is_superuser:
         nav_buttons.append(
             get_nav_button(request, "infos/", _(u"Informations")))
         nav_buttons.append(get_nav_button(request, "news/", _(u"News")))
         nav_buttons.append(
             get_nav_button(request, "candidates/", _(u"Candidates")))
         nav_buttons.append(
             get_nav_button(request, "jury_members/", _(u"Jury member")))
         # Add steps dynamically
         for step in self.steps():
             step_button = get_nav_button(request, "step/%s" % step.url,
                                          _(u"'%s' step" % step.name))
             children = []
             children.append(
                 get_nav_button(request, "step/%s/importation/" % step.url,
                                _(u"1 - Import new candidates")))
             children.append(
                 get_nav_button(request, "step/%s/allocations/" % step.url,
                                _(u"2 - Manage candidates/jury")))
             children.append(
                 get_nav_button(request,
                                "step/%s/notifications/" % step.url,
                                _(u"3 - Notify jury members")))
             children.append(
                 get_nav_button(request, "step/%s/evaluations/" % step.url,
                                _(u"4 - Follow evaluations")))
             children.append(
                 get_nav_button(request, "step/%s/results/" % step.url,
                                _(u"5 - Follow results")))
             step_button["children"] = children
             nav_buttons.append(step_button)
     if admin_site.is_jury_member(
             request):  # jury members only have a limited admin
         nav_buttons.append(
             get_nav_button(request, "evaluate/", _(u"To evaluate")))
     return nav_buttons