# Why i cant use two o more id in my project?

**URL:** <https://forum.djangoproject.com/t/why-i-cant-use-two-o-more-id-in-my-project/8129>\
**Category:** Using Django\
**Created:** [May 29, 2021, 7:00pm UTC](https://forum.djangoproject.com/t/why-i-cant-use-two-o-more-id-in-my-project/8129 "2021-05-29T19:00:37Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luisred1](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/luisred1/32/4678_2.png) [@Luisred1](https://forum.djangoproject.com/u/Luisred1)\
**Post date:** [May 29, 2021, 7:00pm UTC](https://forum.djangoproject.com/t/why-i-cant-use-two-o-more-id-in-my-project/8129/1 "2021-05-29T19:00:38Z")

</div>

_well i tried to explain my project_  
i have a view post and is ok when use post, get but if i try whit a new view send this error  
this is my error.

> Blockquote  
> in \_reverse\_with\_prefix  
> raise NoReverseMatch(msg)  
> django.urls.exceptions.NoReverseMatch: Reverse for ‘landedit’ with no arguments not found. 2 pattern(s) tried: [‘landing/landedit/(?P\<land\_id\>[^/]+)$’, ‘landedit/(?P\<land\_id\>[0-9]+)$’]  
> Blockquote

- landing/views

```auto
def landedit(request,land_id):
    ess = Es.objects.get(pk=land_id)
    estudios = EsForm(instance = ess)
    if request.method == "POST":
        estudios = EsForm(request.POST, instance = ess)
        if estudios.is_valid():
            ess = form.save(commit=False)
            ess.save()
    return render(request, "landing/landedit.html", {'estudios':estudios, 'ess':ess})

```

landing/urls

```auto
from django.urls import path, include
from django.conf import settings

from django.conf import settings
from landing import views
from landing import views as landing_views
from landing.views import pruebaform, AddGeneral, AddyGeneral, landing_page, landedit, landsurf

#app_name = 'landing' 

urlpatterns = [
    path('landing_page/', landing_views.landing_page, name="landing_page"),
    path('landsurf/', landing_views.landsurf, name="landsurf"),
    path('pruebaform', landing_views.pruebaform, name="pruebaform"),
    path('AddyGeneral', landing_views.AddGeneral, name='AddyGeneral'),
    path('AddGeneral', AddGeneral.as_view(), name='AddGeneral'),
]
urlpatterns += [
    path('landedit/<land_id>', landing_views.landedit, name="landedit"),
]

```

landing/models

```auto
class Ess(models.Model):
    nombrempresa = models.CharField(max_length=100, default="Nombre de la Empresa")
    celular = models.CharField(max_length=10, default="Celular")
    Telefono = models.CharField(max_length=10, default="Telefono")
    correo = models.EmailField(max_length=254, default="Correo")
    edad = models.CharField(max_length=10, default="Dia de nacimiento")
    callenumero = models.CharField(max_length=100, default="Calle")
    numerointerior = models.CharField(max_length=5, default="Numero Interior")
    numeroexterior = models.CharField(max_length=5, default="Numero Exterior")
    entrecalles = models.CharField(max_length=50, default="Entre Calles")
    estado = models.CharField(max_length=25, default="Estado")
    ciudad = models.CharField(max_length=25, default="Ciudad")
    codigopostal = models.CharField(max_length=5, default="Codigo Postal")
    image = models.ImageField(upload_to='blog', verbose_name='blog/images', default='static/blog/images/no-img.jpg')
    fecha_registro = models.DateTimeField(auto_now_add=True, null=True)
    update = models.DateTimeField(auto_now_add=True, null=True)
    empresas = models.ManyToManyField(Empresa)

```

landing/forms

```auto

class GeneralForm(forms.ModelForm):

    class Meta:
        model = generales
        fields = ' __all__'
        labels = {
            'nombreempresa':'Nombre de la Empresa',
            'celular':'Celular',
            'Telefono':'Telefono',
            'correo':'Correo',
            'edad':'Edad',
            'callenumero':'Calle Numero',
            'numerointerior':'NI',
            'numeroexterior':'NE',
            'entrecalles':'Entre Calles',
            'estado':'Estado',
            'ciudad':'Ciudad',
            'codigopostal':'CP',
        }
        empresas = CustomModelMultipleChoiceField(queryset=Empresa.objects.all(), widget=forms.CheckboxSelectMultiple)

```

landing/html

```auto

<!DOCTYPE html>
<html lang="es">
{% load i18n %} 
<head>
    <title>PsIQuedu</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" url='/static/blog/img/Logo_psIQedu.jpg'>
    <link rel="shortcut icon" href="/static/blog/img/Imagenpsi.ico">
    <scrip type="text/javascript" src="js/jquery.js"></script>
    <link rel="stylesheet" type="text/css" href="/static/blog/css/centro.css">
</head>
<body>
   <div class="contenido-section x-style">
    <div class="content-home-descrip" >
        <div class="content-home-descrip-contenido" style="color:#cae4db;">
           <h2 style="background-color: #333; color:white;">{{ estudio.nombre }}</h2>
            <div class="content-home-descrip-body">
                <h4 style="background-color: black; color:white; font-size: 10px;">{{ estudio.nombreempresa }}</h4>
                <h4 style="background-color: black; color:white; font-size: 10px;">{{ estudio.update }}</h4>
            </div>
         </div>
    </div>
    </div>
</body>
</html>

```

> Blockquote  
> somebody can help me ?

> Blockquote

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [May 29, 2021, 11:36pm UTC](https://forum.djangoproject.com/t/why-i-cant-use-two-o-more-id-in-my-project/8129/2 "2021-05-29T23:36:41Z")

</div>

> [@Luisred1](#):
>
> django.urls.exceptions.NoReverseMatch: Reverse for ‘landedit’ with no arguments not found. 2 pattern(s) tried: [‘landing/landedit/(?P\<land\_id\>[^/]+)$’, ‘landedit/(?P\<land\_id\>[0-9]+)$’]  
> Blockquote

This error message is referring to a page attempting to be rendered either with a call to `reverse` or with the `url` tag. We would need to see the view (or template) where this is being done. I don’t see a reference to that named url in anything you’ve posted here.

Also, when posting issues here, it’s generally useful to post the complete traceback. Sometimes the _real_ problem isn’t in the last / final message. Sometimes the root issue is found earlier in the trace.

---

<div class="post-metadata">

**Author:** ![Luisred1](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/luisred1/32/4678_2.png) [@Luisred1](https://forum.djangoproject.com/u/Luisred1)\
**Post date:** [May 30, 2021, 1:45am UTC](https://forum.djangoproject.com/t/why-i-cant-use-two-o-more-id-in-my-project/8129/3 "2021-05-30T01:45:20Z")

</div>

> Blockquote  
> Thank by reply  
> Blockquote  
> This is the Html that render to landedit.html

```auto
{% extends 'blog/inicio.html' %}
{% load static %}
{% block title %} Centro {% endblock %}
{% block header %} PLATAFORMA EDUCATIVA ESPECIALIZADA | centro {%endblock %} 
{% block content %}

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

<link rel="stylesheet" type="text/css" href="/static/blog/css/centro.css">
 <!--
<div class="content-centro">
    <form>
        <fieldset>  
            <legend>Soluciones</legend>
                <select id="status" name="status" onChange="mostrar(this.value);">
                    <optgroup label="Elige una opcion">
                        <option value=""></option>
                        <option value="cuadro1">Centro Evaluador</option>
                        <option value="cuadro2">Dialogo2</option>
                        <option value="cuadro3">Dialogo3</option>
                        <option value="cuadro4">Dialogo4</option>
                    </optgroup>
                </select>
        </fieldset>
    </form>
</div> --> 
{% if user.is_authenticated %}
<!--<div id="content-lateral" style="display:block" id="myDIV">-->
<div id="content-lateral" style="display:block">
    <marquee><p>Usuario:<i style="color:black;"> {{ user.username }} </i>.....Registra tus datos</p></marquee>
</div>
<div id="lateral-fix" style="display-block">
    <div class="lateral-box"><a href="#cuadro1" onclick="mytema1()">cuadro 1</a></div>
    <div class="lateral-box"><a href="#cuadro2" onclick="mytema2()">Datos CE</a></div>
    <div class="lateral-box"><a href="#cuadro3" onClick="mytema3()">Logo</a></div>
    <div class="lateral-box"><a href="#cuadro4" onclick="mytema4()">Datos X</a></div>
    <div class="lateral-box"><a href="#cuadro5" onclick="mytema5()">Salir</a></div>
    <div class="lateral-box"><a href="#cuadro7" onclick="mytema7()">Id Es</a></div>
    <div class="lateral-box"><a href="{% url 'landing_page' %}" >My L.Page</a></div>
    <div class="lateral-box"><a href="{% url 'landsurf' %}" >My L.surf</a></div>
   
    <div class="lateral-box"><a href="{% url 'landedit' %}">L. Edit</a></div>

    <div class="lateral-box" ><a onClick="mytema()">color</a></div>
 
    <div id="cuadro2" class="cuadro-x" style="display:none;">
        <div class="content-alumno">
        <!-- <h3 style="color: lightblue;"> Bienvenido </h3>-->
            <div class="content-alumno-formato">
                <form method="POST" class="post-form" autocomplete="off">
                    {% csrf_token %}
                    {{ formato.as_p }} 
                    <input type="submit" value="Submit">
                </form>
            </div>
        </div>
    </div>
    <div id="cuadro3" class="cuadro-x" style="padding: 1px;display:none;">
        <div class="content-alumno"><div class="content-form"><h5>DESCARGA TU IMAGEN</h5>
            {% include 'albums/upload_image.html' %}
        </div>
    </div> </div>
    <div id="cuadro4" class="cuadro-x" style="padding: 5x; display:none;">
    <div class="content-alumno" style="padding: 5x;">
        <h5>Registra tus proximos eventos</h5>
        <a href="{% url 'pruebaform' %}" style="color:silver;">Evento</a>
        <!-- include 'landing/pruebaform.html' -->
        <hr>
        <h5>Registrar Los Datos Generales de la empresa</h5>
        <a href="#" style="color:silver;">Generales</a>
        <hr>
        <h5>Registra tu salida</h5>
        <a href="{% url 'logout' %}" style="color:silver;">Salir</a>
    </div></div>
    <div id="cuadro5" class="cuadro-x" style="padding: 5x; display:none;">
        <div class="content-alumno">
          {% include 'landing/AddGeneral.html' %} 
        </div>
    </div>
    <div id="cuadro6" class="efecto" class="cuadro" style="display:none">
        <div class="content-land-descrip">
            <div class="content-land-descrip-contenido">
                <h1>Direcciona a Landing page </h1>
                <hr>
            </div>
            <div class="nav-menu-land"><a href="{% url 'landing_page' %}"></a>Landing page</div>
        </div> 
    </div> 
    <div id="cuadro7" class="cuadro-x" style="display:none;">
        <div class="content-alumno">
            {% for estudio in estudios %}
                <div class="content-home-descrip-body">
                    <h5>{{ estudio.nombre }} </h5>
                    <a href="/landedit/{{ estudio.land_edit }}" style="font-size:10px;color:silver;">Leer mas</a>               
                    {% if estudio.link %}
                        <p><a href="{{ estudio.link }}">Leer mas</a></p>
                    {% endif %}
                </div>
            {% endfor %}
        </div>
    </div>
        
</div>
{% else %}
    <div class="content-land-descrip">
    <div class="centrar-auth" style="background-color:#F4EB16; color:blue">
        <a href="{% url 'login' %}">Login</a>
    </div>
    <div class="centrar-auth" style="background-color:blue; color:yellow">
        <a href="{% url 'register' %}"><strong>Registro</strong></a>
    </div>
    </div>
{% endif %}
    <div class="content-land-decrip">
        <div class="content-land-descrip-contenido" style="background-color: #417690">
            <h5>prueba content land descrip </h5>
        </div> 
    </div>
{% endblock %}

```

and come from App Blog

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [May 30, 2021, 6:35pm UTC](https://forum.djangoproject.com/t/why-i-cant-use-two-o-more-id-in-my-project/8129/4 "2021-05-30T18:35:35Z")

</div>

This is the URL you’ve defined named `landedit`. Notice that you’ve specified that there must be a parameter. (Identified as `land_id` in the URL.)

> [@Luisred1](#):
>
> ` path('landedit/<land_id>', landing_views.landedit, name="landedit"),`

This is how you’re trying to render the URL named `landedit`

> [@Luisred1](#):
>
> ```auto
> <div class="lateral-box"><a href="{% url 'landedit' %}">L. Edit</a></div>
> 
> ```

Notice that you’re not supplying a parameter there for the reverse resolution of that URL.

See the docs on [Reverse resolution of URLs](https://docs.djangoproject.com/en/3.2/topics/http/urls/#reverse-resolution-of-urls).

---

<div class="post-metadata">

**Author:** ![Luisred1](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/luisred1/32/4678_2.png) [@Luisred1](https://forum.djangoproject.com/u/Luisred1)\
**Post date:** [May 31, 2021, 1:26am UTC](https://forum.djangoproject.com/t/why-i-cant-use-two-o-more-id-in-my-project/8129/5 "2021-05-31T01:26:45Z")

</div>

ok thanks  
then ireplace by it

```auto
<div class="lateral-box"><a href="/landing/landedit/{{'estudios.id}}">L. Edit</a></div>

```

blog/centro.html

```auto
    <div id="cuadro7" class="cuadro-x" style="display:none;">
        <div class="content-alumno">
            {% for estudio in estudios %}
                <div class="content-home-descrip-body">
                    <h5>{{ estudio.nombre }} </h5>
                    <a href="/landing/landedit/{{ estudio.id }}" style="font-size:10px;color:silver;">Leer mas</a>  
                    {% if estudio.link %}
                        <p><a href="{{ estudio.link }}">Leer mas</a></p>
                    {% endif %}
                </div>
            {% endfor %}
        </div>
    </div>

```

and make  
landing/views

```auto
def landedit(request,id):
    estudios = Es.objects.get(id=id)
    #estudios = EsForm(instance = ess)
    #if request.method == "POST":
    # estudios = EsForm(request.POST, instance = ess)
    # if estudios.is_valid():
    # ess = estudios.save(commit=False)
    # ess.save()
    return render(request, "landing/landedit.html", {'estudios':estudios})

```

and  
landing/urls

```auto
urlpatterns += [
    path('landedit/', landing_views.landedit, name="landedit"),
]

```

whit it urls i have the failure

```auto
Page not found (404)
Request Method:	GET
Request URL:	http://127.0.0.1:8000/centro/landing/landedit/1

```

thanks by your help

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [May 31, 2021, 1:29am UTC](https://forum.djangoproject.com/t/why-i-cant-use-two-o-more-id-in-my-project/8129/6 "2021-05-31T01:29:40Z")

</div>

Yes, because _now_ your url doesn’t accept a parameter, but that request is supplying one.

---

<div class="post-metadata">

**Author:** ![Luisred1](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/luisred1/32/4678_2.png) [@Luisred1](https://forum.djangoproject.com/u/Luisred1)\
**Post date:** [May 31, 2021, 4:24am UTC](https://forum.djangoproject.com/t/why-i-cant-use-two-o-more-id-in-my-project/8129/7 "2021-05-31T04:24:19Z")

</div>

Thanks  
I try and try so many time and then the ligth!  
ok  
in blog/centro.html

```auto
 <a href="{{'/landing/landedit/' }}{{ estudio.id }}">Leer mas</a>

```

and is ok  
¡¡¡¡ thanks so muchs !!!

---

<div class="post-metadata">

**Author:** ![Luisred1](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/luisred1/32/4678_2.png) [@Luisred1](https://forum.djangoproject.com/u/Luisred1)\
**Post date:** [May 31, 2021, 4:30am UTC](https://forum.djangoproject.com/t/why-i-cant-use-two-o-more-id-in-my-project/8129/8 "2021-05-31T04:30:48Z")

</div>

To complete this code solution

> Blockquote landing/urls

```auto
urlpatterns += [
    path('landedit/<id>', landing_views.landedit, name="landedit"),
]

```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [May 31, 2021, 1:05pm UTC](https://forum.djangoproject.com/t/why-i-cant-use-two-o-more-id-in-my-project/8129/9 "2021-05-31T13:05:07Z")

</div>

That works, but that’s not the solution I was trying to lead you toward.

The url template tag takes a parameter. The Django-style solution is:  
`<a href="{% url 'landedit' estudio.id %}">...</a>`

(You generally want to use your named urls by name, not by hard-coded path.)

---

<div class="post-metadata">

**Author:** ![Luisred1](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/luisred1/32/4678_2.png) [@Luisred1](https://forum.djangoproject.com/u/Luisred1)\
**Post date:** [May 31, 2021, 1:38pm UTC](https://forum.djangoproject.com/t/why-i-cant-use-two-o-more-id-in-my-project/8129/10 "2021-05-31T13:38:21Z")

</div>

Thanks

Yes . it’s ok

Thanks so much
