To je greška zato što ne može da nađe url_id ajd ako ne uspeš pogledaću večeras detaljno šta si radio pa da vidim gde je greška
уто, 29. јан 2019. у 13:51 Ivan Martić <martic.ivan@gmail.com> је написао/ла:
napravio sam točno kako si rekao i dalje nece, isti error ...vec danima se mucim sa ovime..nešto drugo je posrijedi.--uto, 29. sij 2019. u 12:16 Nebojsa Hajdukovic <nebojsa.zerobet@gmail.com> napisao je:neće raditi ali ne zbog html već zbog greške u viewsprobaj ovakodef productsgrouping_update_view(request, url_id): assigned = get_object_or_404(Material, pk=url_id)naravno prvo moraš da importuješ get object or 404:from django.shortcuts import get_object_or_404--уто, 29. јан 2019. у 12:00 Ivan Martić <martic.ivan@gmail.com> је написао/ла:Bok Nebojša,mislim da je stvar u HTML možda prije, jer mi je ranije sve radilo..u jednom trenu je puknula veza. Neznam točno kada.Znači, da odem na url productsgrouping prikaze sve grupe, kad kliknem na grupu (dodam joj a=href) no reverse mathc, ako maknem atribute u url dobijem #, a ako ručno upišem productsgrouping/update/1 onda prikaze i nastavi sve kako treba.Znaci samo nemogu povezati ta dva linka....pogledaj htmlove u privitkuhvala ti za pomoć--uto, 29. sij 2019. u 11:35 Nebojsa Hajdukovic <nebojsa.zerobet@gmail.com> napisao je:A što ne uradiš update preko class based view daleko je lakše?Ako hoćeš preko funkcije ja radim sa get_object_or_404, ovako:def productsgrouping_update_view(request, url_id):product_lista = get_object_or_404(MaterialGroup, pk=url_id)--уто, 29. јан 2019. у 10:20 Ivan Martić <martic.ivan@gmail.com> је написао/ла:not sure what to say--čet, 24. sij 2019. u 13:53 Ivan Martić <martic.ivan@gmail.com> napisao je: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 <andreas.kuhne@hypercode.se> 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:?Regards,Andréas--Den tors 24 jan. 2019 kl 13:28 skrev Ivan Martić <martic.ivan@gmail.com>: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></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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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.
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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.
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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_C8HUsxdpqz-MGqcpw0ZwgFOvrYZ-RJte6-H5x38b97ciQ%40mail.gmail.com.
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/CAJ60hW3aGwHHutJiXASPkmgDKtn1g1QBgU4PpcuKa1zodypfRQ%40mail.gmail.com.
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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_C8ZxPMgVB6Z%3DXZ3OxNa8wQmvfmCtsvDKaxifmXHV1eZhA%40mail.gmail.com.
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/CAJ60hW3HSn_PcNNHihst69x37QAqh1KO_pYFAusUvF-j6C9DvQ%40mail.gmail.com.
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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_C9woh%3D05E3EpBzOpfkdXT-nas427zqr8MLsDpLn0cYcFw%40mail.gmail.com.
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/CAJ60hW20Q5bVzCWd5tU%3Dhhb21zEgpwyQkbrjqxkNkOG_bXC0sA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment