NoReverseMatch at

0

Hi, could you help me with this error:

Reverse for 'order_sub' with arguments '()' and keyword arguments '{' request_id ': 53,' code_expert ':' AA-0002 '}' not found. 1 pattern (s) tried: ['request / approve / (? P \ d +) / (? P \ d +) $']

this is the url:

url (r '^ approve / (? P \ d +) / (? P \ d +) $', Orderapp.views.pedido_sub, name="orden_sub"),

and this the button in index where it marks in red the error:

Approve

please wait for your help for this case, thanks in advance! views.py:

def request_sub (request, request_id, cod_expert):     art = Articulo.objects.get (id = cod_experto)     order = Order.objects.get (id = order_id)     if request.method == 'GET':         order.estado = 'delivered'         order.save ()         order.date_delivery = datetime.now ()         order.save ()         art.stock = order.quantity - art.stock         art.save ()         return redirect ('user: home')     return render (request, 'index.html', {'request': request})

    
asked by Demaro Create 17.02.2017 в 00:51
source

1 answer

1

That's why you are passing named arguments to your url, when your url is asking for positional arguments, on the button you probably have something like:

<a href="{% url pedido_sub id_pedido=obj.pedido cod_experto=obj.experto %}">

And you should change it to:

<a href="{% url pedido_sub obj.pedido obj.experto %}">

Then you have to make sure that your view also accepts positional and unnamed parameters.

    
answered by 17.02.2017 в 01:45