示例#1
0
def index(_write_tmpl, _usuario_logado):
    salvar_path = router.to_path(salvar)
    query = Curso.query_encontrar_cursos_de_usuario(_usuario_logado.key)
    cursos = query.fetch()
    for c in cursos:
        c.detalhar_path = router.to_path(detalhar, c.key.id())
    _write_tmpl('/home/curso', {'cursos': cursos, 'salvar_path': salvar_path})
示例#2
0
 def test_home_index(self):
     self.assertEqual("/first_handler/1",
                      router.to_path(first_handler.index, "1"))
     self.assertEqual("/pack/1/2/3", router.to_path(pack_home.index, 1, 2,
                                                    3))
     self.assertEqual("/1/2/3", router.to_path(home.index, 1, 2, 3))
     self.assertEqual("/", router.to_path(home.index))
示例#3
0
def index(ret_path='/'):
    g_path = router.to_path(google.index, ret_path=ret_path)
    dct = {'login_google_path': users.create_login_url(g_path),
           'login_passwordless_path': router.to_path(send_email, ret_path=ret_path),
           'login_facebook_path': router.to_path(facebook.index, ret_path=ret_path),
           'faceapp': facade.get_facebook_app_data().execute().result}
    return TemplateResponse(dct, 'login/home.html')
示例#4
0
 def short_comportamento_dict(comportamento):
     comportamento_dct = short_form.fill_with_model(comportamento)
     comportamento_dct['edit_path'] = router.to_path(
         edit_path, comportamento_dct['id'])
     comportamento_dct['delete_path'] = router.to_path(
         delete_path, comportamento_dct['id'])
     return comportamento_dct
示例#5
0
def listImages():  #usar para listar os arquivos de mp3 e gif dos cards ^^
    comando = blob_facade.list_blob_files_cmd()
    arquivos = comando()
    download_path = to_path(download)
    for arq in arquivos:
        arq.download_path = to_path(download_path, arq.key.id(), arq.filename)
    return arquivos
示例#6
0
def index(_logged_user):
    if not _logged_user.email == '*****@*****.**':
        return RedirectResponse('/erro')
    return TemplateResponse({'security_table_path': router.to_path(permission_home.index),
                             'permission_admin_path': router.to_path(admin),
                             'passwordless_admin_path': router.to_path(passwordless.form),
                             'facebook_admin_path': router.to_path(facebook.form)})
示例#7
0
 def short_observacoe_dict(observacoe):
     observacoe_dct = short_form.fill_with_model(observacoe)
     observacoe_dct['edit_path'] = router.to_path(edit_path,
                                                  observacoe_dct['id'])
     observacoe_dct['delete_path'] = router.to_path(delete_path,
                                                    observacoe_dct['id'])
     return observacoe_dct
示例#8
0
def index():
    return TemplateResponse({
        'passwordless_admin_path':
        router.to_path(passwordless.form),
        'facebook_admin_path':
        router.to_path(facebook.form)
    })
示例#9
0
def index(_logged_user):
    """
    This is a example of file upload using
    Google Cloud Storage
    :return:
    """
    success_url = router.to_path(upload)
    bucket = get_default_gcs_bucket_name()
    logging.info(bucket)
    url = blobstore.create_upload_url(success_url, gs_bucket_name=bucket)
    cmd = blob_facade.list_blob_files_cmd(_logged_user)
    blob_form = blob_facade.blob_file_form()
    deletar_path_base = router.to_path(delete)
    download_path_base = router.to_path(download)

    def localizar_blob(blob):
        dct = blob_form.fill_with_model(blob, 64)
        dct['delete_path'] = router.to_path(deletar_path_base, dct['id'])
        dct['download_path'] = router.to_path(download_path_base, blob_key=blob.blob_key, filename=dct['filename'])
        return dct

    blob_files = [localizar_blob(b) for b in cmd()]
    context = {'upload_url': url,
               'blob_files': blob_files}
    return TemplateResponse(context, 'updown/home.html')
示例#10
0
 def short_lancamento_dict(lancamento):
     lancamento_dct = short_form.fill_with_model(lancamento)
     lancamento_dct['edit_path'] = router.to_path(edit_path,
                                                  lancamento_dct['id'])
     lancamento_dct['delete_path'] = router.to_path(delete_path,
                                                    lancamento_dct['id'])
     return lancamento_dct
示例#11
0
def index():
    context = {
        'salvar_path': router.to_path(rest.save),
        'deletar_path': router.to_path(rest.delete),
        'editar_path': router.to_path(rest.update),
        'listar_path': router.to_path(rest.index)}
    return TemplateResponse(context)
示例#12
0
 def to_dict(self):
     dct = super(Participante, self)._to_dict()
     id = self.key.id()
     dct['id'] = id
     dct['deletarPath'] = router.to_path(deletar, id)
     dct['editarPath'] = router.to_path(editar, id)
     return dct
示例#13
0
def index(_write_tmpl, _usuario_corrente):
    salvar_path = router.to_path(salvar)
    query = Curso.query_encontrar_cursos_de_usuario(_usuario_corrente.key)
    cursos = query.fetch()
    for c in cursos:
        c.detalhar_path = router.to_path(detalhar, c.key.id())
    _write_tmpl('curso_home.html', {'cursos': cursos, 'salvar_path': salvar_path})
示例#14
0
def index(_resp, categoria_selecionada=""):

    editar_path_base = to_path(editar)
    deletar_path_base = to_path(deletar)
    produtos = Produto.query().fetch()

    for prod in produtos:
        prod.editar_path = to_path(editar_path_base, prod.key.id())
        prod.deletar_path = to_path(deletar_path_base, prod.key.id())

    contexto = {'categorias': Categoria.query()}

    if categoria_selecionada == "":
        contexto['produtos'] = Produto.query_ordenada_por_nome().fetch()
        contexto['categoria_selecionada'] = None
    else:
        # sql = ndb.Key(Categoria, int(categoria_selecionada))
        # contexto['produtos']=Produto.query(Produto.categoria==sql).fetch()
        contexto['produtos'] = Produto.query_por_categoria_ordenada_por_nome(
            categoria_selecionada).fetch()
        contexto['categoria_selecionada'] = Categoria.get_by_id(
            int(categoria_selecionada))

    contexto['resultados'] = len(contexto['produtos'])
    return TemplateResponse(contexto)
示例#15
0
 def test_querystring(self):
     query_string = {'foo': 'bar'}
     self.assertEqual("/pack?foo=bar", router.to_path(pack, **query_string))
     query_string = {'foo': 'bar', 'param': 1}
     self.assertEqual("/pack?foo=bar&param=1", router.to_path(pack, **query_string))
     query_string = {'foo': 'çáê', 'param': 1}
     self.assertEqual("/pack?foo=%C3%A7%C3%A1%C3%AA&param=1", router.to_path(pack, **query_string))
示例#16
0
def index(_logged_user, _handler, **catequizando_properties):
    access_denid = validate_permission(COORDENADOR, _logged_user)
    if access_denid:
        return access_denid
    if catequizando_properties.get("files"):
        blob_infos = _handler.get_uploads("files[]")
        blob_key = blob_infos[0].key()
        avatar = to_path(download, blob_key)
        catequizando_properties["avatar"] = avatar
        catequizando_properties.pop("files", None)
    cmd = catequizando_facade.save_catequizando_cmd(**catequizando_properties)
    user_not_unique = False
    try:
        if catequizando_properties.get('username') and User.is_unique(catequizando_properties.get('username')):
            cmd()
        else:
            user_not_unique = True
    except CommandExecutionException:
        context = {'errors': cmd.errors,
                   'catechized': catequizando_properties}
        return TemplateResponse(context, '/catequizandos/catequizando.html')
    if user_not_unique:
        cmd.errors['username'] = unicode(u'Usuário já existe.')
        context = {'errors': cmd.errors,
                   'catechized': catequizando_properties}
        return TemplateResponse(context, '/catequizandos/catequizando.html')
    sleep(0.5)
    return RedirectResponse(router.to_path(catequizandos))
示例#17
0
def busca_produtos(_logged_user, busca):
    cmd = facade.list_observacoes_cmd()
    observacoes = cmd()
    busca = slugify(busca)
    pesquisa = Observacoe.query(Observacoe.busca >= busca).order(Observacoe.busca)

    get_dono_cmd_lista=[GetDonoObs(o) for o in observacoes]
    paralelo=CommandParallel(*get_dono_cmd_lista)
    paralelo()

    edit_path = router.to_path(edit)
    delete_path = router.to_path(delete)
    short_form = facade.observacoe_short_form()

    def short_observacoe_dict(observacoe):
        observacoe_dct = short_form.fill_with_model(observacoe)
        observacoe_dct['edit_path'] = router.to_path(edit_path, observacoe_dct['id'])
        observacoe_dct['delete_path'] = router.to_path(delete_path, observacoe_dct['id'])
        return observacoe_dct


    short_observacoes = [short_observacoe_dict(observacoe) for observacoe in observacoes]
    for observacao,dono_comando in zip(short_observacoes,get_dono_cmd_lista):
        observacao['dono_flag']=(dono_comando.result ==_logged_user)
    context = {'observacoe': short_observacoes,
               'new_path': router.to_path(new),
               'observacoes': pesquisa.fetch()
               }
    return TemplateResponse(context, router.to_path('observacoes/admin/home.html'))
示例#18
0
 def localize_blob_file(blob_file):
     blob_file_dct = blob_file_form.fill_with_model(blob_file, 64)
     blob_file_dct['delete_path'] = router.to_path(delete_path, blob_file_dct['id'])
     blob_file_dct['download_path'] = router.to_path(download_path,
                                                     blob_file.blob_key,
                                                     blob_file_dct['filename'])
     return blob_file_dct
示例#19
0
def index(_logged_user):
    """
    This is a example of file upload using
    Google Cloud Storage
    :return:
    """
    success_url = router.to_path(upload)
    bucket = get_default_gcs_bucket_name()
    logging.info(bucket)
    url = blobstore.create_upload_url(success_url, gs_bucket_name=bucket)
    cmd = blob_facade.list_blob_files_cmd(_logged_user)
    blob_form = blob_facade.blob_file_form()
    deletar_path_base = router.to_path(delete)
    download_path_base = router.to_path(download)

    def localizar_blob(blob):
        dct = blob_form.fill_with_model(blob, 64)
        dct['delete_path'] = router.to_path(deletar_path_base, dct['id'])
        dct['download_path'] = router.to_path(download_path_base,
                                              blob_key=blob.blob_key,
                                              filename=dct['filename'])
        return dct

    blob_files = [localizar_blob(b) for b in cmd()]
    context = {'upload_url': url, 'blob_files': blob_files}
    return TemplateResponse(context, 'updown/home.html')
示例#20
0
 def localizar_blob(blob):
     dct = blob_form.fill_with_model(blob, 64)
     dct['delete_path'] = router.to_path(deletar_path_base, dct['id'])
     dct['download_path'] = router.to_path(download_path_base,
                                           blob_key=blob.blob_key,
                                           filename=dct['filename'])
     return dct
示例#21
0
def index():
    context = {
        'salvar_path': router.to_path(rest.save),
        'deletar_path': router.to_path(rest.delete),
        'editar_path': router.to_path(rest.update),
        'listar_path': router.to_path(rest.index)}
    return TemplateResponse(context)
示例#22
0
文件: curso.py 项目: renzon/livrogae
def index(_write_tmpl):
    query = Curso.query_ordenada_por_nome()
    cursos = query.fetch()
    dct = {'lista_cursos': cursos,
           'matricula_url': router.to_path(matricula),
           'salvar_url': router.to_path(salvar)}
    _write_tmpl('/templates/curso_home.html', dct)
示例#23
0
文件: home.py 项目: renzon/livrogae
def index(_write_tmpl, ret_path='/'):
    g_path = router.to_path(google.index, ret_path=ret_path)
    dct = {'login_google_path': users.create_login_url(g_path),
           'login_passwordless_path': router.to_path(enviar_email,ret_path=ret_path),
           'login_facebook_path': router.to_path(facebook.index,ret_path=ret_path),
           'faceapp': facade.get_facebook_app_data().execute().result}
    _write_tmpl('login/home.html', dct)
示例#24
0
 def localize_categoria(categoria):
     categoria_dct = categoria_form.fill_with_model(categoria)
     categoria_dct['edit_path'] = router.to_path(edit_path,
                                                 categoria_dct['id'])
     categoria_dct['delete_path'] = router.to_path(delete_path,
                                                   categoria_dct['id'])
     return categoria_dct
示例#25
0
def index(_logged_user):
    cmd = facade.list_observacoes_cmd()
    observacoes = cmd()
    get_dono_cmd_lista = [GetDonoObs(o) for o in observacoes]
    paralelo = CommandParallel(*get_dono_cmd_lista)
    paralelo()

    edit_path = router.to_path(edit)
    delete_path = router.to_path(delete)
    short_form = facade.observacoe_short_form()

    def short_observacoe_dict(observacoe):
        observacoe_dct = short_form.fill_with_model(observacoe)
        observacoe_dct['edit_path'] = router.to_path(edit_path,
                                                     observacoe_dct['id'])
        observacoe_dct['delete_path'] = router.to_path(delete_path,
                                                       observacoe_dct['id'])
        return observacoe_dct

    short_observacoes = [
        short_observacoe_dict(observacoe) for observacoe in observacoes
    ]
    for observacao, dono_comando in zip(short_observacoes, get_dono_cmd_lista):
        observacao['dono_flag'] = (dono_comando.result == _logged_user)
    context = {
        'observacoes': short_observacoes,
        'new_path': router.to_path(new)
    }
    return TemplateResponse(context)
示例#26
0
def index():
    context = {
        'admin_path': router.to_path(admin),
        'salvar_path': router.to_path(rest.save),
        'editar_path': router.to_path(rest.update),
        'apagar_path': router.to_path(rest.delete),
        'listar_path': router.to_path(rest.index)}
    return TemplateResponse(context, 'books/home.html')
示例#27
0
def index():
    context = {
        'rest_list_path': router.to_path(rest.index),
        'rest_new_path': router.to_path(rest.new),
        'rest_edit_path': router.to_path(rest.edit),
        'rest_delete_path': router.to_path(rest.delete)
    }
    return TemplateResponse(context, 'itenss/itens_home.html')
示例#28
0
def index():
    comando = blob_facade.list_blob_files_cmd()
    arquivos = comando()
    download_path = to_path(download)
    for arq in arquivos:
        arq.download_path=to_path(download_path, arq.key.id(), arq.filename)
    ctx = {'arquivos': arquivos}
    return TemplateResponse(ctx, template_path="/updown_home.html")
示例#29
0
def index(_logged_user):
    contexto = {
        'rest_new_path': router.to_path(rest.new),
        'rest_list_path': router.to_path(rest.index),
        'rest_delete_path': router.to_path(rest.delete),
        'rest_edit_path': router.to_path(rest.edit)
    }
    return TemplateResponse(contexto)
示例#30
0
def index():
    comando = blob_facade.list_blob_files_cmd()
    arquivos = comando()
    download_path = to_path(download)
    for arq in arquivos:
        arq.download_path = to_path(download_path, arq.key.id(), arq.filename)
    ctx = {'arquivos': arquivos}
    return TemplateResponse(ctx)
示例#31
0
def index():
    return TemplateResponse(
        {
            'security_table_path': router.to_path(permission_home.index),
            'permission_admin_path': router.to_path(admin),
            'passwordless_admin_path': router.to_path(passwordless.form),
            'facebook_admin_path': router.to_path(facebook.form)
        }, 'admin/home.html')
示例#32
0
def index(desenho_selecionada = None):
    ctx ={'desenhos': Desenho.query_ordenada_por_nome().fetch(),
          'salvar_path': to_path(salvar),'pesquisar_path':to_path(index)}

    if desenho_selecionada is None:
        ctx['desenho_selecionada']=None
    else:
        ctx['desenho_selecionada']= Desenho.get_by_id(int(desenho_selecionada))
    return TemplateResponse(ctx,'desenhos/desenhos_home.html')
示例#33
0
def index(ret_path="/"):
    g_path = router.to_path(google.index, ret_path=ret_path)
    dct = {
        "login_google_path": users.create_login_url(g_path),
        "login_passwordless_path": router.to_path(send_email, ret_path=ret_path),
        "login_facebook_path": router.to_path(facebook.index, ret_path=ret_path),
        "faceapp": facade.get_facebook_app_data().execute().result,
    }
    return TemplateResponse(dct)
示例#34
0
 def test_querystring(self):
     query_string = {'foo': 'bar'}
     self.assertEqual("/pack?foo=bar", router.to_path(pack, **query_string))
     self.assertEqual("/pack?foo=bar", router.to_path('/pack', **query_string))
     query_string = {'foo': 'bar', 'param': 1}
     self.assertEqual("/pack?foo=bar&param=1", router.to_path(pack, **query_string))
     self.assertEqual("/pack?foo=bar&param=1", router.to_path('/pack', **query_string))
     query_string = {'foo': 'çáê', 'param': 1}
     self.assertEqual("/pack?foo=%C3%A7%C3%A1%C3%AA&param=1", router.to_path('/pack', **query_string))
示例#35
0
def index(categoria_selecionada=None):
    ctx={'categorias':Categoria.query_ordenada_por_nome().fetch(),
         'salvar_path':to_path(salvar),
         'pesquisar_path': to_path(index)}
    if categoria_selecionada is None:
        ctx['categoria_selecionada']= None
    else:
        ctx['categoria_selecionada']=Categoria.get_by_id(int(categoria_selecionada))
    return TemplateResponse(ctx, 'produtos/produto_home.html')
示例#36
0
def logar(_handler, _resp, username, passwd):
    found = User.get_by_username_and_pw(username.strip(), passwd)
    if not found:
        _handler.redirect(router.to_path(site_index) + "?errors=loggin_error")
    
    else:
        token = "%s%s" % (username, AUTH_TOKEN)
        _resp.set_cookie('logged_user', str(found.key.id()))
        _handler.redirect(router.to_path(site_index))
示例#37
0
def teleportToReview(app_id, **kwargs):
    review_form = ReviewForm()
    review = Review()
    review.app = app_id
    review_form.fill_with_model(review)
    contexto = {'salvar_path': router.to_path(reviewss.form.salvar),
                'reviews': review_form,
                'admin_path': router.to_path(admin)}
    return TemplateResponse(contexto, 'reviewss/form.html')
示例#38
0
def upload(_handler, **jogos_properties):
    if jogos_properties.get('files'):
        blob_infos = _handler.get_uploads("files[]")
        blob_key = blob_infos[0].key()
        avatar = router.to_path(download, blob_key)
        cmd = Game.get_by_id(long(jogos_properties['id']))
        cmd.foto = avatar
        cmd.put()
        return RedirectResponse(router.to_path(index))
示例#39
0
def edit_form(app_id):
    app_id = int(app_id)
    app = App.get_by_id(app_id)
    app_form = AppForm()
    app_form.fill_with_model(app)
    contexto = {'salvar_path': router.to_path(editar, app_id),
                'apps': app_form,
                'admin_path': router.to_path(admin)}
    return TemplateResponse(contexto, 'appss/form.html')
示例#40
0
def edit_form(review_id):
    review_id = int(review_id)
    review = Review.get_by_id(review_id)
    review_form = ReviewForm()
    review_form.fill_with_model(review)
    contexto = {'salvar_path': router.to_path(editar, review_id),
                'reviews': review_form,
                'admin_path': router.to_path(admin)}
    return TemplateResponse(contexto, 'reviewss/form.html')
示例#41
0
def index(_write_tmpl, _usuario_corrente):
    salvar_path = router.to_path(salvar)
    query = Curso.query_encontrar_cursos_de_usuario(_usuario_corrente.key)
    cursos = query.fetch()
    for c in cursos:
        c.detalhar_path = router.to_path(detalhar, c.key.id())
    _write_tmpl('curso_home.html', {
        'cursos': cursos,
        'salvar_path': salvar_path
    })
示例#42
0
文件: db.py 项目: renzon/fatec-script
def salvar(**kwargs):
    escravo_form = EscravoForm(**kwargs)
    erros = escravo_form.validate()
    if erros:
        contexto = {"salvar_path": router.to_path(salvar), "erros": erros, "escravo": kwargs}
        return TemplateResponse(contexto, "db/home.html")
    else:
        escravo = escravo_form.fill_model()
        escravo.put()
        return RedirectResponse(router.to_path(listar))
示例#43
0
def editar(livro_id, **propriedades):
    atualizar_livro_cmd = livro_facade.atualizar_livro_cmd(livro_id, **propriedades)
    try:
        atualizar_livro_cmd()
        return RedirectResponse(router.to_path(index))
    except CommandExecutionException:
        contexto = {'salvar_path': router.to_path(editar, livro_id),
                    'erros': atualizar_livro_cmd.errors,
                    'livro': propriedades}
        return TemplateResponse(contexto, 'livros/form.html')
示例#44
0
文件: db.py 项目: renzon/fatec-script
def listar_json(_resp):
    query = Escravo.query().order(-Escravo.name)
    escravos = query.fetch()
    form_short = EscravoFormShort()
    escravos = [form_short.fill_with_model(e) for e in escravos]
    for e in escravos:
        e["edit_path"] = router.to_path(edit_form, e["id"])
        e["delete_path"] = router.to_path(deletar, e["id"])

    return JsonUnsecureResponse(escravos)
示例#45
0
def editar(escravo_id, **kwargs):
    editar_escravo_cmd = escravo_facade.editar_escravo_cmd(escravo_id, **kwargs)
    try:
        editar_escravo_cmd()
        return RedirectResponse(router.to_path(index))
    except CommandExecutionException:
        contexto = {'salvar_path': router.to_path(editar),
                    'escravo': kwargs,
                    'erros': editar_escravo_cmd.errors}
        return TemplateResponse(contexto, 'escravos/form.html')
示例#46
0
文件: db.py 项目: renzon/fatec-script
def listar():
    query = Escravo.query().order(-Escravo.name)
    escravos = query.fetch()
    form_short = EscravoFormShort()
    escravos = [form_short.fill_with_model(e) for e in escravos]
    for e in escravos:
        e["edit_path"] = router.to_path(edit_form, e["id"])
        e["delete_path"] = router.to_path(deletar, e["id"])
    contexto = {"escravos": escravos}
    return TemplateResponse(contexto)
示例#47
0
文件: filme.py 项目: renzon/gae-t01
def index(_write_tmpl):
    query = Filme.query().order(Filme.nome)

    filmes = query.fetch()
    for f in filmes:
        f.editar_path = router.to_path(editar, f.key.urlsafe())
        f.deletar_path = router.to_path(deletar, f.key.id())
        f.alugar_path = router.to_path(alugar, f.key.id())
    dct = {'salvar_path': router.to_path(salvar),
           'filmes': filmes}
    _write_tmpl('templates/filme_home.html', dct)
示例#48
0
def index(selected_course=None):
    edit_path_base = to_path(edit)
    deletar_path_base = to_path(deletar)
    ctx={'courses':Course.query_order_by_name().fetch(),
         'salvar_path':to_path(salvar)}
    if selected_course is None:
        ctx['selected_course'] = None
    else:
        ctx['selected_course'] = Course.get_by_id(int(selected_course))
        ctx['students']=Student.query_by_course_order_by_name(selected_course).fetch()
    return TemplateResponse(ctx,'students/students_home.html')
示例#49
0
def salvar(_logged_user, **propriedades):
    salvar_livro_cmd = livro_facade.salvar_livro_cmd(**propriedades)
    salvar_livro_com_autor = livro_facade.salvar_livro_com_autor_cmd(_logged_user, salvar_livro_cmd)
    try:
        salvar_livro_com_autor()
        return RedirectResponse(router.to_path(index))
    except CommandExecutionException:
        contexto = {'salvar_path': router.to_path(salvar),
                    'erros': salvar_livro_cmd.errors,
                    'livro': propriedades}
        return TemplateResponse(contexto, 'livros/form.html')
示例#50
0
文件: home.py 项目: carolinags/tekton
def index():
    cmd = funcionario2_facade.list_funcionario2s_cmd()
    funcionario2s = cmd()
    funcionario2_form = funcionario2_facade.funcionario2_form()

    context = {'rest_new_path': router.to_path(rest.new),
               'rest_list_path': router.to_path(rest.index),
               'rest_delete_path': router.to_path(rest.delete),
               'rest_edit_path': router.to_path(rest.edit)}

    return TemplateResponse(context, 'funcionario2s/funcionario2_home.html')
示例#51
0
def exibir(tipo_id):
    tipo = BebidaTipo.get_by_id(int(tipo_id))
    query = Bebida.query(Bebida.tipo == tipo.key).order(Bebida.preco)
    lista_de_bebidas = query.fetch()
    contexto = {
        'lista_de_bebidas' : lista_de_bebidas,
        'tipo' : tipo,
        'salvar_path' : router.to_path(salvar),
        'return_path' : router.to_path(index)
    }
    return TemplateResponse(contexto, 'bebidas/exibir.html')
示例#52
0
def index():
    comando = blob_facade.list_blob_files_cmd()
    arquivos = comando()
    download_path = to_path(download)
    delete_path = router.to_path(delete)
    for arq in arquivos:
        arq.delete_path = router.to_path(delete_path, arq.key.id(),
                                         arq.filename)
        arq.download_path = to_path(download_path, arq.key.id(), arq.filename)
    ctx = {'arquivos': arquivos}
    return TemplateResponse(ctx, 'updown_home.html')
示例#53
0
def index():
    query = Categoria.query_ordenada_por_nome()
    edit_path_base = to_path(edit)
    deletar_path_base = to_path(deletar)
    categorias = query.fetch()
    for cat in categorias:
        key = cat.key
        key_id = key.id()
        cat.edit_path = to_path(edit_path_base, key_id)
        cat.deletar_path = to_path(deletar_path_base, key_id)
    ctx = {'salvar_path': to_path(salvar), 'categorias': categorias}
    return TemplateResponse(ctx, 'categorias/categorias_home.html')
示例#54
0
def salvar(** propriedades):
    imovel_form = ImovelForm(**propriedades)
    errors = imovel_form.validate()
    if errors:
        contexto = {'save_path':router.to_path(salvar),
                    'errors':errors,
                    'imovel':imovel_form}
        return TemplateResponse(contexto, '/imoveis/form.html')
    else:
        imovel = imovel_form.fill_model()
        imovel.put()
        return RedirectResponse(router.to_path(index))
示例#55
0
def index():
    salvar_path = to_path(salvar)
    listar_path = to_path(index)
    apagar_path = to_path(apagar)

    ctx = {
        'salvar_path': salvar_path,
        'apagar_path': apagar_path,
        'listar_path': listar_path
    }

    return TemplateResponse(ctx, 'pedido/pedidoHome.html')
示例#56
0
文件: home.py 项目: beatorizu/tekton
def index(lid=''):
    ctx = {
        'rest_new_path': to_path(rest.salvar),
        'rest_delete_path': to_path(rest.deletar),
        'rest_rev_path': to_path(rev.index),
        'lid': lid
    }
    if lid is '':
        ctx['rest_list_path'] = to_path(rest.index)
    else:
        ctx['rest_list_path'] = to_path(rest.indexl, lid)
    return TemplateResponse(ctx, 'cards/home.html')