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.