# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. from sellmo.core.registry.inject import mixin_model, mixin_class from . import partials import sellmo.apps.product as _product import sellmo.contrib.attribute as _attribute _product.indexes['ProductIndex'].inject(mixin_class( lambda: partials.ProductIndex )) def ProductSearchQuerySet(value): class ModelAttributeIterator(partials.ModelAttributeIterator, value.model_iterator_class): pass class ProductSearchQuerySet(value): model_iterator_class = ModelAttributeIterator return value _product.indexes['ProductSearchQuerySet'].inject(ProductSearchQuerySet)
from sellmo.core.registry.inject import mixin_model, mixin_class, inherit_model, inherit_class from . import partials import sellmo.apps.product as _product import sellmo.apps.purchase as _purchase import sellmo.apps.cart as _cart _purchase.models['Purchase'].inject(mixin_model( lambda : partials.Purchase )) _purchase.models['PurchaseQuerySet'].inject(mixin_class( lambda : partials.PurchaseQuerySet )) _product.models['ProductPurchase'].inject(inherit_model( lambda : _purchase.models.Purchase )) def Product(value): # NOQA class Product(value): objects = _product.models.ProductManager.from_queryset( _product.models.ProductQuerySet)() class Meta(value.Meta): pass