django.urls.reverse_lazy - python examples

Here are the examples of the python api django.urls.reverse_lazy taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

145 Examples 7

3 View Complete Implementation : vendas.py
Copyright MIT License
Author : thiagopena
    def get(self, request, *args, **kwargs):
        venda_id = kwargs.get('pk', None)
        instance = PedidoVenda.objects.get(id=venda_id)
        instance.status = '2'
        instance.save()
        return redirect(reverse_lazy('vendas:editarpedidovendaview', kwargs={'pk': instance.id}))

3 View Complete Implementation : natureza_operacao.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(NaturezaOperacaoListView,
                        self).get_context_data(**kwargs)
        context['satle_complete'] = 'NATUREZAS DA OPERAÇÃO CADASTRADAS'
        context['add_url'] = reverse_lazy('fiscal:addnaturezaoperacaoview')
        return context

3 View Complete Implementation : nota_fiscal.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(ManifestacaoDestinatarioView,
                        self).get_context_data(**kwargs)
        context['satle_complete'] = 'MANIFESTAÇÃO DO DESTINATÁRIO'
        context['btn_text'] = 'ENVIAR'
        context['form_id'] = 'manifestacao_destinatario_form'
        context['saida'] = True
        context['return_url'] = reverse_lazy('fiscal:listanotafiscalsaidaview')
        return context

3 View Complete Implementation : natureza_operacao.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(EditarNaturezaOperacaoView,
                        self).get_context_data(**kwargs)
        context['return_url'] = reverse_lazy(
            'fiscal:listanaturezaoperacaoview')
        return context

3 View Complete Implementation : vendas.py
Copyright MIT License
Author : thiagopena
    def get(self, request, *args, **kwargs):
        venda_id = kwargs.get('pk', None)
        instance = OrcamentoVenda.objects.get(id=venda_id)
        instance.status = '2'
        instance.save()
        return redirect(reverse_lazy('vendas:editarorcamentovendaview', kwargs={'pk': instance.id}))

3 View Complete Implementation : lancamento.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(AdicionarContaPagarView,
                        self).get_context_data(**kwargs)
        context['satle_complete'] = 'ADICIONAR CONTA A PAGAR'
        context['return_url'] = reverse_lazy('financeiro:listacontapagarview')
        return context

3 View Complete Implementation : transportadora.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(TransportadorasListView,
                        self).get_context_data(**kwargs)
        context['satle_complete'] = 'TRANSPORTADORAS CADASTRADAS'
        context['add_url'] = reverse_lazy('cadastro:addtransportadoraview')
        context['tipo_pessoa'] = 'transportadora'
        return context

3 View Complete Implementation : pagamento.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(EditarCondicaoPagamentoView,
                        self).get_context_data(**kwargs)
        context['return_url'] = reverse_lazy(
            'vendas:listacondicaopagamentoview')
        return context

3 View Complete Implementation : user_checkin.py
Copyright GNU General Public License v3.0
Author : tamuhack-org
    def test_post_succeeds_for_volunteer(self):
        self.create_active_wave()
        app = Application.objects.create(**self.application_fields, wave=self.wave1)
        volunteer_token = self.get_volunteer_token()

        response = self.client.post(
            reverse_lazy("volunteer:user-checkin"),
            data=self.data_dict,
            HTTP_AUTHORIZATION=volunteer_token,
        )
        app.refresh_from_db()

        self.astertEqual(response.status_code, 200)
        self.astertEqual(app.status, STATUS_CHECKED_IN)

3 View Complete Implementation : transportadora.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(AdicionarTransportadoraView,
                        self).get_context_data(**kwargs)
        context['satle_complete'] = 'CADASTRAR TRANSPORTADORA'
        context['return_url'] = reverse_lazy(
            'cadastro:listatransportadorasview')
        context['tipo_pessoa'] = 'transportadora'
        return context

3 View Complete Implementation : pagamento.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(CondicaoPagamentoListView,
                        self).get_context_data(**kwargs)
        context['satle_complete'] = 'CONDIÇÕES DE PAGAMENTO CADASTRADAS'
        context['add_url'] = reverse_lazy('vendas:addcondicaopagamentoview')
        return context

3 View Complete Implementation : tributos.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(AdicionarGrupoFiscalView,
                        self).get_context_data(**kwargs)
        context['satle_complete'] = 'ADICIONAR GRUPO FISCAL'
        context['return_url'] = reverse_lazy('fiscal:listagrupofiscalview')
        return context

3 View Complete Implementation : lancamento.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(ContaReceberHojeListView,
                        self).get_context_data(**kwargs)
        context['satle_complete'] = 'CONTAS A RECEBER DO DIA ' + \
            datetime.now().date().strftime('%d/%m/%Y')
        context['add_url'] = reverse_lazy('financeiro:addcontareceberview')
        return context

3 View Complete Implementation : nota_fiscal.py
Copyright MIT License
Author : thiagopena
    def view_context(self, context):
        context[
            'satle_complete'] = 'NOTAS FISCAIS DE FORNECEDORES (ENTRADA DE MATERIAL)'
        context['add_url'] = reverse_lazy('fiscal:addnotafiscalentradaview')
        context['importar_nota_url'] = reverse_lazy(
            'fiscal:importarnotafiscalentrada')
        context['entrada'] = True
        return context

3 View Complete Implementation : nota_fiscal.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(ConsultarCadastroView, self).get_context_data(**kwargs)
        context['satle_complete'] = 'CONSULTAR CADASTRO'
        context['btn_text'] = 'CONSULTAR'
        context['form_id'] = 'consultar_cadastro_form'
        context['saida'] = True
        context['return_url'] = reverse_lazy('fiscal:listanotafiscalsaidaview')
        return context

3 View Complete Implementation : nota_fiscal.py
Copyright MIT License
Author : thiagopena
    def view_context(self, context):
        context['satle_complete'] = 'EDITAR NOTA FISCAL DE SAÍDA ' + \
            str(self.object.serie) + '/' + str(self.object.n_nf_saida)
        context['return_url'] = reverse_lazy('fiscal:listanotafiscalsaidaview')
        context['saida'] = True
        return context

3 View Complete Implementation : compras.py
Copyright MIT License
Author : thiagopena
    def get(self, request, *args, **kwargs):
        compra_id = kwargs.get('pk', None)
        instance = OrcamentoCompra.objects.get(id=compra_id)
        instance.status = '2'
        instance.save()
        return redirect(reverse_lazy('compras:editarorcamentocompraview', kwargs={'pk': instance.id}))

3 View Complete Implementation : nota_fiscal.py
Copyright MIT License
Author : thiagopena
    def view_context(self, context):
        context['satle_complete'] = 'EDITAR NOTA FISCAL DE ENTRADA ' + \
            str(self.object.serie) + '/' + str(self.object.n_nf_entrada)
        context['return_url'] = reverse_lazy(
            'fiscal:listanotafiscalentradaview')
        context['entrada'] = True
        return context

3 View Complete Implementation : nota_fiscal.py
Copyright MIT License
Author : thiagopena
    def get(self, request, *args, **kwargs):
        nota_id = kwargs.get('pk', None)
        nota_obj = NotaFiscalSaida.objects.get(pk=nota_id)

        resp = HttpResponse(content_type='application/pdf')

        processador_nota = ProcessadorNotaFiscal()
        danfce_pdf = processador_nota.gerar_danfce(nota_obj)

        if processador_nota.erro:
            messages.error(self.request, processador_nota.message)
            return redirect(reverse_lazy('fiscal:editarnotafiscalsaidaview', kwargs={'pk': nota_obj.id}))
        else:
            messages.success(self.request, processador_nota.message)
            resp.write(danfce_pdf)
            return resp

3 View Complete Implementation : confirm.py
Copyright GNU General Public License v3.0
Author : tamuhack-org
    def test_requires_login(self) -> None:
        self.create_active_wave()
        application = Application(**self.application_fields, wave=self.wave1)
        application.save()
        self.user.application = application
        self.user.save()

        response: HttpResponse = self.client.post(
            reverse_lazy("application:update", args=(application.id,))
        )

        self.astertRedirects(
            response,
            f"{reverse_lazy('customauth:login')}?next={reverse_lazy('application:update', args=(application.id,))}",
        )

3 View Complete Implementation : lancamento.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(AdicionarContaReceberView,
                        self).get_context_data(**kwargs)
        context['satle_complete'] = 'ADICIONAR CONTA A RECEBER'
        context['return_url'] = reverse_lazy(
            'financeiro:listacontareceberview')
        return context

3 View Complete Implementation : lancamento.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(ContaPagarAtrasadasListView,
                        self).get_context_data(**kwargs)
        context['satle_complete'] = 'CONTAS A PAGAR ATRASADAS'
        context['add_url'] = reverse_lazy('financeiro:addcontapagarview')
        return context

3 View Complete Implementation : nota_fiscal.py
Copyright MIT License
Author : thiagopena
    def get(self, request, *args, **kwargs):
        processador_nota = ProcessadorNotaFiscal()
        nfe_id = kwargs.get('pk', None)
        nota_obj = NotaFiscalSaida.objects.get(id=nfe_id)
        processador_nota.validar_nota(nota_obj)

        if processador_nota.erro:
            messages.error(self.request, processador_nota.message)
        else:
            messages.success(self.request, processador_nota.message)

        return redirect(reverse_lazy('fiscal:editarnotafiscalsaidaview', kwargs={'pk': nfe_id}))

3 View Complete Implementation : lancamento.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(EditarContaReceberView,
                        self).get_context_data(**kwargs)
        context['return_url'] = reverse_lazy(
            'financeiro:listacontareceberview')
        return context

3 View Complete Implementation : empresa.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(EmpresasListView, self).get_context_data(**kwargs)
        context['satle_complete'] = 'EMPRESAS CADASTRADAS'
        context['add_url'] = reverse_lazy('cadastro:addempresaview')
        context['tipo_pessoa'] = 'empresa'
        return context

3 View Complete Implementation : pagamento.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(AdicionarCondicaoPagamentoView,
                        self).get_context_data(**kwargs)
        context['satle_complete'] = 'ADICIONAR CONDIÇÃO DE PAGAMENTO'
        context['return_url'] = reverse_lazy(
            'vendas:listacondicaopagamentoview')
        return context

3 View Complete Implementation : transportadora.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(EditarTransportadoraView,
                        self).get_context_data(**kwargs)
        context['return_url'] = reverse_lazy(
            'cadastro:listatransportadorasview')
        context['tipo_pessoa'] = 'transportadora'
        return context

3 View Complete Implementation : movimento.py
Copyright MIT License
Author : thiagopena
    def view_context(self, context):
        context['satle_complete'] = 'MOVIMENTO DE TRANSFERÊNCIA EM ESTOQUE N°' + \
            str(self.object.id)
        context['return_url'] = reverse_lazy(
            'estoque:listatransferenciasestoqueview')
        return context

3 View Complete Implementation : nota_fiscal.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(InutilizarNotasView, self).get_context_data(**kwargs)
        context['satle_complete'] = 'INUTILIZAR NOTAS'
        context['btn_text'] = 'ENVIAR'
        context['form_id'] = 'inutilizar_notas_form'
        context['saida'] = True
        context['return_url'] = reverse_lazy('fiscal:listanotafiscalsaidaview')
        return context

3 View Complete Implementation : nota_fiscal.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(EmitirNotaView, self).get_context_data(**kwargs)
        context['satle_complete'] = 'EMISSÃO DE NOTA FISCAL'
        context['btn_text'] = 'ENVIAR NOTA'
        context['form_id'] = 'emitir_nota_form'
        context['saida'] = True
        context['return_url'] = reverse_lazy(
            'fiscal:editarnotafiscalsaidaview', kwargs={'pk': self.object.pk})
        return context

3 View Complete Implementation : nota_fiscal.py
Copyright MIT License
Author : thiagopena
    def view_context(self, context):
        context['satle_complete'] = 'NOTAS FISCAIS'
        context['add_url'] = reverse_lazy('fiscal:addnotafiscalsaidaview')
        context['importar_nota_url'] = reverse_lazy(
            'fiscal:importarnotafiscalsaida')
        context['saida'] = True
        return context

3 View Complete Implementation : lancamento.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(ContaReceberAtrasadasListView,
                        self).get_context_data(**kwargs)
        context['satle_complete'] = 'CONTAS A RECEBER ATRASADAS'
        context['add_url'] = reverse_lazy('financeiro:addcontareceberview')
        return context

3 View Complete Implementation : compras.py
Copyright MIT License
Author : thiagopena
    def get(self, request, *args, **kwargs):
        compra_id = kwargs.get('pk', None)
        instance = PedidoCompra.objects.get(id=compra_id)
        instance.status = '2'
        instance.save()
        return redirect(reverse_lazy('compras:editarpedidocompraview', kwargs={'pk': instance.id}))

3 View Complete Implementation : nota_fiscal.py
Copyright MIT License
Author : thiagopena
    def cancelar_nota(self):
        processador_nota = ProcessadorNotaFiscal()
        processador_nota.cancelar_nota(self.object)

        if processador_nota.erro:
            messages.error(self.request, processador_nota.message)
        else:
            messages.success(self.request, processador_nota.message)

        return redirect(reverse_lazy('fiscal:editarnotafiscalsaidaview', kwargs={'pk': self.object.id}))

3 View Complete Implementation : lancamento.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(ContaPagarHojeListView,
                        self).get_context_data(**kwargs)
        context['satle_complete'] = 'CONTAS A PAGAR DO DIA ' + \
            datetime.now().date().strftime('%d/%m/%Y')
        context['add_url'] = reverse_lazy('financeiro:addcontapagarview')
        return context

3 View Complete Implementation : nota_fiscal.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(CancelarNotaView, self).get_context_data(**kwargs)
        context['satle_complete'] = 'CANCELAMENTO DE NOTA FISCAL'
        context['btn_text'] = 'CANCELAR NOTA'
        context['form_id'] = 'cancelar_nota_form'
        context['saida'] = True
        context['return_url'] = reverse_lazy(
            'fiscal:editarnotafiscalsaidaview', kwargs={'pk': self.object.pk})
        return context

3 View Complete Implementation : nota_fiscal.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(BaixarNotaView, self).get_context_data(**kwargs)
        context['satle_complete'] = 'BAIXAR NOTA'
        context['btn_text'] = 'ENVIAR'
        context['form_id'] = 'baixar_nota_form'
        context['saida'] = True
        context['return_url'] = reverse_lazy('fiscal:listanotafiscalsaidaview')
        return context

3 View Complete Implementation : fornecedor.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(FornecedoresListView, self).get_context_data(**kwargs)
        context['satle_complete'] = 'FORNECEDORES CADASTRADOS'
        context['add_url'] = reverse_lazy('cadastro:addfornecedorview')
        context['tipo_pessoa'] = 'fornecedor'
        return context

3 View Complete Implementation : empresa.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(AdicionarEmpresaView, self).get_context_data(**kwargs)
        context['satle_complete'] = 'CADASTRAR EMPRESA'
        context['return_url'] = reverse_lazy('cadastro:listaempresasview')
        context['tipo_pessoa'] = 'empresa'
        return context

3 View Complete Implementation : cliente.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(ClientesListView, self).get_context_data(**kwargs)
        context['satle_complete'] = 'CLIENTES CADASTRADOS'
        context['add_url'] = reverse_lazy('cadastro:addclienteview')
        context['tipo_pessoa'] = 'cliente'
        return context

3 View Complete Implementation : compras.py
Copyright MIT License
Author : thiagopena
    def view_context(self, context):
        context['satle_complete'] = 'EDITAR ORÇAMENTO DE COMPRA N°' + \
            str(self.object.id)
        context['return_url'] = reverse_lazy(
            'compras:listaorcamentocompraview')
        return context

3 View Complete Implementation : nota_fiscal.py
Copyright MIT License
Author : thiagopena
    def emitir_nota(self):
        processador_nota = ProcessadorNotaFiscal()
        processador_nota.emitir_nota(self.object)

        if processador_nota.erro:
            messages.error(self.request, processador_nota.message)
        else:
            messages.success(self.request, processador_nota.message)

        return redirect(reverse_lazy('fiscal:editarnotafiscalsaidaview', kwargs={'pk': self.object.id}))

3 View Complete Implementation : fornecedor.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(AdicionarFornecedorView,
                        self).get_context_data(**kwargs)
        context['satle_complete'] = 'CADASTRAR FORNECEDOR'
        context['return_url'] = reverse_lazy('cadastro:listafornecedoresview')
        context['tipo_pessoa'] = 'fornecedor'
        return context

3 View Complete Implementation : cliente.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(AdicionarClienteView, self).get_context_data(**kwargs)
        context['satle_complete'] = 'CADASTRAR CLIENTE'
        context['return_url'] = reverse_lazy('cadastro:listaclientesview')
        context['tipo_pessoa'] = 'cliente'
        return context

3 View Complete Implementation : natureza_operacao.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(AdicionarNaturezaOperacaoView,
                        self).get_context_data(**kwargs)
        context['satle_complete'] = 'ADICIONAR NATUREZA DA OPERAÇÃO'
        context['return_url'] = reverse_lazy(
            'fiscal:listanaturezaoperacaoview')
        return context

3 View Complete Implementation : views.py
Copyright MIT License
Author : thiagopena
    def post(self, request, *args, **kwargs):
        user = User.objects.get(pk=self.kwargs['pk'])
        if not user.is_superuser:
            user.user_permissions.clear()
            for nova_permissao_codename in request.POST.getlist('select_permissoes'):
                nova_permissao = Permission.objects.get(
                    codename=nova_permissao_codename)
                user.user_permissions.add(nova_permissao)
        messages.success(
            self.request, 'Permissões do usuário <b>{0}</b> atualizadas com sucesso.'.format(user.username))
        return redirect(reverse_lazy('login:usuariodetailview', kwargs={'pk': self.kwargs['pk']}))

3 View Complete Implementation : nota_fiscal.py
Copyright MIT License
Author : thiagopena
    def get(self, request, *args, **kwargs):
        nota_id = kwargs.get('pk', None)
        nota_obj = NotaFiscalSaida.objects.get(pk=nota_id)

        resp = HttpResponse(content_type='application/pdf')

        processador_nota = ProcessadorNotaFiscal()
        danfe_pdf = processador_nota.gerar_danfe(nota_obj)

        if processador_nota.erro:
            messages.error(self.request, processador_nota.message)
            return redirect(reverse_lazy('fiscal:editarnotafiscalsaidaview', kwargs={'pk': nota_obj.id}))
        else:
            messages.success(self.request, processador_nota.message)
            resp.write(danfe_pdf)
            return resp

3 View Complete Implementation : lancamento.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(AdicionarEntradaView, self).get_context_data(**kwargs)
        context['satle_complete'] = 'ADICIONAR RECEBIMENTO'
        context['return_url'] = reverse_lazy(
            'financeiro:listarecebimentosview')
        return context

3 View Complete Implementation : nota_fiscal.py
Copyright MIT License
Author : thiagopena
    def get_context_data(self, **kwargs):
        context = super(ConsultarNotaView, self).get_context_data(**kwargs)
        context['satle_complete'] = 'CONSULTAR NOTA'
        context['btn_text'] = 'ENVIAR'
        context['form_id'] = 'consultar_nota_form'
        context['saida'] = True
        context['return_url'] = reverse_lazy('fiscal:listanotafiscalsaidaview')
        return context

3 View Complete Implementation : movimento.py
Copyright MIT License
Author : thiagopena
    def view_context(self, context):
        context['satle_complete'] = 'MOVIMENTO DE ENTRADA EM ESTOQUE N°' + \
            str(self.object.id)
        context['return_url'] = reverse_lazy(
            'estoque:listaentradasestoqueview')
        return context