Send and receive parameter via url - Django

1

I have this tournament detail template, I need to send as parameter the id of the tournament because when creating a team it has a direct relationship to the tournament that participates. As I send and receive in the template equipo_create the id of the tournament.

tournament_detail.html

    <h5><a href="{% url 'torneos:equipo_crear' object.id%}">Agregar Equipo</a></h5>

urls.py

    url(r'^detalle/(?P<pk>\d+)/$', login_required(Torneo_DetailView.as_view()), name='torneo_detalle'),
    url(r'^(?P<pk>\d+)/equipo/$', login_required(Equipo_CreateView.as_view()), name='equipo_crear'),
    
asked by jhon perez 18.04.2017 в 23:30
source

1 answer

3
{% url 'torneos:equipo_crear' pk=object.id %}

The "pk" parameter is requested by name, it may work to send the value by name.

    
answered by 19.04.2017 в 03:31