Exemplo n.º 1
0
# 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

from . import partials

import sellmo.apps.purchase as _purchase
import sellmo.apps.cart as _cart


def Cart(value): # NOQA
    class Cart(value):

        objects = _cart.models.CartManager.from_queryset(
            _cart.models.CartQuerySet)()

        class Meta(value.Meta):
            pass

    return Cart


_purchase.models['Purchase'].inject(mixin_model(
    lambda : partials.Purchase
))

_cart.models['Cart'].inject(Cart)
Exemplo n.º 2
0
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.

# 3. Neither the name of the copyright holder nor the names of its contributors
# may be used to endorse or promote products derived from this software without
# specific prior written permission.

# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# 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

import sellmo.apps.customer as _customer

from . import partials


_customer.models['Customer'].inject(mixin_model(
    lambda: partials.Customer
))
Exemplo n.º 3
0
from . import partials

import sellmo.apps.checkout as _checkout
import sellmo.apps.purchase as _purchase
import sellmo.apps.customer as _customer

from .constants import CUSTOMER_REQUIRED

if not CUSTOMER_REQUIRED:
    _checkout.models['Order'].inject(
        inherit_model(lambda: _customer.models.Customer))


def Order(value):
    class Order(value):

        objects = _checkout.models.OrderManager.from_queryset(
            _checkout.models.OrderQuerySet)()

        class Meta(value.Meta):
            pass

    return Order


_checkout.models['Order'].inject(Order)

_purchase.models['Purchase'].inject(mixin_model(lambda: partials.Purchase))

_customer.models['Address'].inject(mixin_model(lambda: partials.Address))
Exemplo n.º 4
0
from .constants import CUSTOMER_REQUIRED

if not CUSTOMER_REQUIRED:
    _checkout.models['Order'].inject(inherit_model(
        lambda: _customer.models.Customer
    ))


def Order(value):
    class Order(value):

        objects = _checkout.models.OrderManager.from_queryset(
            _checkout.models.OrderQuerySet)()

        class Meta(value.Meta):
            pass

    return Order


_checkout.models['Order'].inject(Order)

_purchase.models['Purchase'].inject(mixin_model(
    lambda : partials.Purchase
))

_customer.models['Address'].inject(mixin_model(
    lambda : partials.Address
))
Exemplo n.º 5
0
from sellmo.core.registry.inject import mixin_class, mixin_model

import sellmo.apps.product as _product
import sellmo.contrib.variation as _variation
import sellmo.contrib.product.subtypes.simple_product as _simple_product
import sellmo.contrib.product.subtypes.configurable_product as _configurable_product


def register_variation_product_subtypes(value):
    value.PRODUCT_SUBTYPES.append(
        _simple_product.models.SimpleProduct)

    value.PRODUCT_SUBTYPES.append(
        _configurable_product.models.ConfigurableProduct)

    return value

_vartiation.models['Variant'].inject(register_variation_product_subtypes)

_product.models['Product'].inject(mixin_model(
    lambda: partials.Product
))

_product.indexes['ProductIndex'].inject(mixin_class(
    lambda: partials.ProductIndex
))