Hi Andréas, sorry for misspeling in codes. All is working ok except when i try to put url tag for 'update_productsgrouping'. I need to update group with new products but It does not argument for group id. What do you think i am doing wrong...?
čet, 24. sij 2019. u 13:43 Andréas Kühne <[email protected]> napisao je: > Hi, > > The reason you are getting this is that you are adding an argument to the > productsgrouping url - which doesn't take any arguments. > > In your code you have: > <a href="{% url 'productsgrouping' item.id%}"></a> > (Which by the way isn't correct either, I think you mean: <a href="{% url > 'productsgrouping' item.id%}">{{ item }} - {{item.id}} </a>) > > If you look at the url for the producsgrouping view, you have: > path('', views.productsgrouping_view, name='productsgrouping'), > > Which doesn't take any arguments, when you then add an argument django > can't find the right URL. > > You may mean: > <a href="{% url 'update_productsgrouping' item.id%}">{{ item }} - {{ > item.id}} </a> > ? > > Regards, > > Andréas > > > Den tors 24 jan. 2019 kl 13:28 skrev Ivan Martić <[email protected]>: > >> Hi all, >> >> i am having issue with url tag, every time i put url tag like --{% url >> 'productsgrouping' item.id%}-- i get no reverse error. >> Can you help me figure it out on what am i doing wrong? >> >> view: >> def productsgrouping_view(request): >> queryset = MaterialGroup.objects.all() >> context = {"list" : queryset} >> return render(request, 'qif/productsgrouping/productsgroup.html', context) >> >> def productsgrouping_update_view(request, url_id): >> product_lista = MaterialGroup.objects.get(id=url_id) >> product_url_id = ProductgroupinputForm(request.POST or None, >> instance=product_lista) >> context1 = {'product_url_id': product_url_id, 'product_lista': >> product_lista} >> >> if product_url_id.is_valid(): >> product_url_id.save() >> >> return render(request, 'productsgroup-update.html', context1) >> >> url: >> urlpatterns = [ >> path('', views.productsgrouping_view, name='productsgrouping'), >> path('update/<int:url_id>/', views.productsgrouping_update_view, >> name='update_productsgrouping'), >> path('new/', views.creategroup_view, name='create_group'), >> ] >> >> html: >> {% extends 'base.html' %} >> {% block content %} >> <ul > >> {% for item in list %} >> <h1> >> <a href="{% url 'productsgrouping' item.id%}"></a> >> {{ item }} - {{item.id}} >> </h1> >> {% endfor %} >> {% endblock %} >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at https://groups.google.com/group/django-users. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/ca1ef95d-166a-40ef-91bc-16f2d704f2ee%40googlegroups.com >> <https://groups.google.com/d/msgid/django-users/ca1ef95d-166a-40ef-91bc-16f2d704f2ee%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAK4qSCcnxCFkss1b8sOTDW3Kb6Vc1fFst4MO024%2BEq%3DwXLGjcg%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAK4qSCcnxCFkss1b8sOTDW3Kb6Vc1fFst4MO024%2BEq%3DwXLGjcg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFab_C9Vn0x87bxxBShySUfcC6mQvxZD%3D_f-ej67eWMhWQ9TQQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

