def index(request, cat_id): if cat_id == None: cat = Category.objects.first() else: cat = Category.objects.get(pk=cat_id) goods = Good.objects.filter(category=cat).order_by('name') s = 'Категория.: ' + cat.name + '<br><br>' for good in goods: s = s + '(' + str(good.pk) + ')' + good.name + '<br>' return HttpResponse(s) urlpatterns = patterns('', url(r'^(?:(?P<cat_id>\d+)/)?$', views.index, name='index'), url(r'^good/(?P<good_id>\d+)/$', views.good, name='good'), ) 

Please explain in more detail what this parameter carries? Where did he come from and why not without him.

    1 answer 1

    This is the request object. When a page is requested, Django creates this object, which contains various data about the request. There are stored methods (GET, POST), headers, etc. You had better go to the documentation. There are in Russian