Ejemplo n.º 1
0
def all(request):
    """Return all docs"""

    auth_this = auth_support.auth_user(request)
    if not auth_this:
        return support.auth_error()

    database = DataBase()

    data = {
        'docs': database.doc.all()
    }

    return render_to_response('documents/all.html', data)
Ejemplo n.º 2
0
def default_answer_data(request):
    """Generate default data for views"""

    databse = DataBase()
    auth_this = auth_support.auth_user(request)

    if auth_this:
        need = len(databse.get_all_need_slave(request.user))
    else:
        need = 0

    return RequestContext(request, {
        'auth': auth_this,
        'req_url': request.path,
        'Title': config.Title,
        'Need': need,
        })
Ejemplo n.º 3
0
def addcheck(request, id_main = 0, id_slave = 0):
    """Test to add chains

    Response: True - ok, False - not ok
    """

    auth_this = auth_support.auth_user(request)
    if not auth_this:
        return support.auth_error()

    if id_main == 0 or id_slave == 0:
        raise Http404

    database = DataBase()

    data = {
        'check': database.check_add_chain(id_main, id_slave)
    }

    return render_to_response('chains/addcheck.html', data)