コード例 #1
0
ファイル: main.py プロジェクト: 3taps/geo
def main(request):
    """ Respond to the "/" URL.

        This is the main entry point for the tableau_editor application.

        We let the user select a location to edit the tableaux for.
    """
    if not request.user.is_authenticated:
        return HttpResponseRedirect(reverse(settings.ADMIN_HOME_VIEW))

    levels = []
    for level in Level.objects.all():
        levels.append(level)

    starred_locs = []
    for loc in Location.objects.filter(starred=True):
        starred_locs.append(loc)

    menu_html = menus.generate(request, "Tableau Editor", "tableau_editor", "main")

    base_url = reverse("tableau_editor.views.select", args=["Z"])[:-2]

    selector_html = location_selector.generate(
        request, "Edit the tableaux for a location", "Tableau Editor", "tableau_editor", "main", base_url
    )

    return render_to_response(
        "tableau_editor/templates/main.html",
        {"menu_html": menu_html, "selector_html": selector_html, "starred_locs": starred_locs, "levels": levels},
        context_instance=RequestContext(request),
    )
コード例 #2
0
ファイル: main.py プロジェクト: 3taps/geo
def main(request):
    """ Implement the "/" URL.

        This is the main entry point for the location_editor application.

        We let the user select a location to edit, either by typing in the
        desired location name or code, or by selecting the location level to
        start browsing.
    """
    if not request.user.is_authenticated:
        return HttpResponseRedirect(reverse(settings.ADMIN_HOME_VIEW))

    levels = []
    for level in Level.objects.all():
        levels.append(level)

    starred_locs = []
    for loc in Location.objects.filter(starred=True):
        starred_locs.append(loc)

    has_import_export = ("import_export" in settings.INSTALLED_APPS)

    menu_html = menus.generate(request, "Location Editor",
                               "location_editor", "main")

    base_url = reverse("location_editor.views.details", args=["Z"])[:-2]

    selector_html = location_selector.generate(request,
                                               "Select a location to edit",
                                               "Location Editor",
                                               "location_editor", "main",
                                               base_url)

    return render_to_response("location_editor/templates/main.html",
                              {'menu_html'         : menu_html,
                               'selector_html'     : selector_html,
                               'starred_locs'      : starred_locs,
                               'levels'            : levels,
                               'has_import_export' : has_import_export},
                              context_instance=RequestContext(request))