コード例 #1
0
ファイル: inject.py プロジェクト: adaptivdesign/django-sellmo
        class Meta(value.Meta):
            pass

    return Address


_customer.models['AddressQuerySet'].inject(inherit_class(
    lambda: _customer.models.AddresseeQuerySet,
))

_customer.models['AddressManager'].inject(inherit_class(
    lambda: _customer.models.AddresseeManager
))

_customer.models['Address'].inject(inherit_model(
    lambda: _customer.models.Addressee
))

_customer.models['Address'].inject(Address)


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

        objects = _customer.models.CustomerManager.from_queryset(
            _customer.models.CustomerQuerySet)()

        class Meta(value.Meta):
            pass

    return Customer
コード例 #2
0
ファイル: inject.py プロジェクト: trb116/pythonanalyzer
            _customer.models.AddressQuerySet)()

        class Meta(value.Meta):
            pass

    return Address


_customer.models['AddressQuerySet'].inject(
    inherit_class(lambda: _customer.models.AddresseeQuerySet, ))

_customer.models['AddressManager'].inject(
    inherit_class(lambda: _customer.models.AddresseeManager))

_customer.models['Address'].inject(
    inherit_model(lambda: _customer.models.Addressee))

_customer.models['Address'].inject(Address)


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

        objects = _customer.models.CustomerManager.from_queryset(
            _customer.models.CustomerQuerySet)()

        class Meta(value.Meta):
            pass

    return Customer
コード例 #3
0
# 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, inherit_model

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)
コード例 #4
0
ファイル: inject.py プロジェクト: adaptivdesign/django-sellmo
# 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, inherit_model

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

コード例 #5
0
ファイル: inject.py プロジェクト: adaptivdesign/django-sellmo
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

    return Product

_product.models['Product'].inject(Product)