Reverse_lazy parameter in Django

0
class CrearClienti(CreateView):
    template_name = 'clienti.html'
    form_class = RegCliModelForm
    success_url = reverse_lazy('clienti:crear_clienti')

I get this error

'clienti' is not a registered namespace

I'm trying to work with manners: this is the url

<div class="col-lg-10">
    <a onclick="return abrir_modal('{% url 'clienti:crear_clienti' %}')" class="btn btn-primary">Crear</a>
</div>

Addition: this is my code in urls.py

urlpatterns = [
url(r'^admin/', admin.site.urls),   
url(r'^clienti/$', ListadoClienti.as_view(), name="Listado_Clienti"),
url(r'^nuevo/$', CrearClienti.as_view(), name="crear_Clienti"),

Thanks for the help

    
asked by Vacanito 23.01.2018 в 11:47
source

1 answer

0

Your error is due to the fact that you have not defined a namespace called clienti

It would be enough if you used the reverse_lazy only with the name of the url that you are defining in your urls file in this way

success_url = reverse_lazy('crear_Clienti')

Where crear_Clienti is the name you have defined for the url in your urls.py

    
answered by 23.01.2018 / 21:52
source