def index(request,*args,**kwargs): cataloga_obj=Cataloga.objects.all() catalogb_obj=Catalogb.objects.all() # item_obj=Item.objects.all() condition={} for k,v in kwargs.items(): kwargs[k] = int(v) if int(v): condition[k]=int(v) item_obj=Item.objects.filter(**condition) print(kwargs) return render(request,'index.html',{'cataloga_obj':cataloga_obj, 'catalogb_obj':catalogb_obj, 'item_obj':item_obj, 'kwargs':kwargs, })
def index(request,*args,**kwargs): cataloga_obj=Cataloga.objects.all() catalogb_obj=Catalogb.objects.all() # item_obj=Item.objects.all() condition={} for k,v in kwargs.items(): kwargs[k] = int(v) if int(v): condition[k]=int(v) item_obj=Item.objects.filter(**condition) print(kwargs) return render(request,'index.html',{'cataloga_obj':cataloga_obj, 'catalogb_obj':catalogb_obj, 'item_obj':item_obj, 'kwargs':kwargs, })
url
urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^index/(?P<cataloga_id>d+)/(?P<catalogb_id>d+)', views.index), ]