예제 #1
0
def chown_view(request, doctype=None):
    msg = ""
    doctypes = [(doc["description"], doc["meta"]["document_type"])
                for doc in BASEDOCS.values()]

    groups = Group.objects.all().order_by("name")
    if doctype:
        docs = get_docs(doctype, sort=True)
    else:
        docs = None
    context = {
        'docs'     : docs,
        'doctype'  : doctype,
        "doctypes" : doctypes,
        "groups"   : groups
        }

    if request.POST:
        groupname = request.POST.get("group-to")
        update_ids = request.POST.getlist("chown")
        msg = chown_docs(update_ids, groupname, doctype, docs, settings.INDEX_NAME)
        context["msg"] = msg
        context["updated"] = update_ids
    t = env.get_template('chown_list.html')
    s = template_render(t, context)
    return HttpResponse(s)
예제 #2
0
def documents_view(request):
    doctypes = sorted([(doc['meta']['document_type'], doc['description'])
                       for doc in BASEDOCS.values()])
    t = env.get_template('documents.html')
    s = template_render(t, {'doctypes' : doctypes})
    return HttpResponse(s)