При запуске кода выше, я получаю сообщение об ошибке:
TypeError: 'Catg_id' is an invalid keyword argument for this function" for the function named as 'ch' above.
Как исправить эту ошибку?
from categories.models import Catg, Type, Product, Choice
from django.shortcuts import render
def ch(request, Type_id, Product_id, Catg_id):
ca = Catg.objects.get(pk=Catg_id)
p = Type.objects.get(pk=Type_id)
cho = Product.objects.get(pk=Product_id)
alls = Choice.objects.all()
context3 = {
'p': p,
'alls': alls,
'cho': cho,
'ca': ca,
}
return render(request, "service providers.html", context3)
ТАКЖЕ В URLS.PY
url(r'^categories/(?P<Catg_id>[0-9])/(?P<Type_id>[0-9]+)/(?P<Product_id>[0-9]+)/$', views.Choice, name='choice'),
И В МОДЕЛЯХ.PY
class Choice(models.Model):
chname = models.ForeignKey(Product, on_delete=models.CASCADE)
chn = models.CharField(max_length=1000, default=" ")
def __str__(self):
return self.chn