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
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
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
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
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
<!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