awesto / django-shop

A Django based shop system
http://www.django-shop.org
BSD 3-Clause "New" or "Revised" License
3.18k stars 1.04k forks source link

Cannot filter product by category #747

Closed dismine closed 5 years ago

dismine commented 5 years ago

Hi,

For some reasons django shop start showing all products regardless of selected CMS page. Can somebody help me to debug this problem? I cannot find a place where filtering should happen.

jrief commented 5 years ago

Please check that the CMSPagesFilterBackend is set correctly. It can be configured globally using REST_FRAMEWORK['DEFAULT_FILTER_BACKENDS'] or locally inside you Catalog's List View overriding filter_backends. Please inform me, if this hint helped.

dismine commented 5 years ago

@jrief thank you for your reply. Currently my settings look like this:

REST_FRAMEWORK = {
    'DEFAULT_RENDERER_CLASSES': (
        'shop.rest.money.JSONRenderer',
        'rest_framework.renderers.BrowsableAPIRenderer',
    ),
    'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',),
    'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
    'PAGE_SIZE': 2,
}

Also i checked django shop tutorial example project. Don't see CMSPagesFilterBackend there too.

dismine commented 5 years ago

@jrief thank you, adding CMSPagesFilterBackend to list of default filters helped.