tangentlabs/django-oscar — pull request #790 by st4lk (2013-08-13 23:06:59+00:00)
Title: define Product's base_queryset in 'browsable' manager

Current [catalogue.views.get_product_base_queryset](https://github.com/tangentlabs/django-oscar/blob/master/oscar/apps/catalogue/views.py#L95) method is not easy to customize, because it is needed also to subclass all views, that are using it, to point to customized `get_product_base_queryset`.

Also, it is better for readability to keep methods, that defines queryset, in model.
So, after this pull request, such code can be used:

Product.browsable.base_queryset()

instead of

get_product_base_queryset()

Now, to customize `base_queryset` it is needed just to place `queryset.py` in `catalogue` app and define there needed `base_queryset`. And all views and other modules will use this customized method.

Example of custom queryset.py:

from oscar.apps.catalogue.queryset import\
ProductBrowsableQuerySet as OscarProductBrowsableQuerySet

class ProductBrowsableQuerySet(OscarProductBrowsableQuerySet):
def base_queryset(self):
qs = super(ProductBrowsableQuerySet, self).base_queryset()
return qs.prefetch_related('attribute_values__attribute')

Google group thread: https://groups.google.com/forum/#!topic/django-oscar/VJLnb9gwn60