Example #1
0
"""
Vanilla product models
"""
from oscar.core.loading import is_model_registered
from oscar.apps.catalogue.abstract_models import *  # noqa

__all__ = ["ProductAttributesContainer"]


if not is_model_registered("catalogue", "ProductClass"):

    class ProductClass(AbstractProductClass):
        pass

    __all__.append("ProductClass")


if not is_model_registered("catalogue", "Category"):

    class Category(AbstractCategory):
        pass

    __all__.append("Category")


if not is_model_registered("catalogue", "ProductCategory"):

    class ProductCategory(AbstractProductCategory):
        pass

    __all__.append("ProductCategory")
Example #2
0
from oscar.apps.analytics.abstract_models import (
    AbstractProductRecord, AbstractUserProductView,
    AbstractUserRecord, AbstractUserSearch)
from oscar.core.loading import is_model_registered

__all__ = []


if not is_model_registered('analytics', 'ProductRecord'):
    class ProductRecord(AbstractProductRecord):
        pass

    __all__.append('ProductRecord')


if not is_model_registered('analytics', 'UserRecord'):
    class UserRecord(AbstractUserRecord):
        pass

    __all__.append('UserRecord')


if not is_model_registered('analytics', 'UserProductView'):
    class UserProductView(AbstractUserProductView):
        pass

    __all__.append('UserProductView')


if not is_model_registered('analytics', 'UserSearch'):
    class UserSearch(AbstractUserSearch):
Example #3
0
from oscar.core.loading import is_model_registered

from . import abstract_models

__all__ = []


if not is_model_registered('payment', 'Transaction'):
    class Transaction(abstract_models.AbstractTransaction):
        pass

    __all__.append('Transaction')


if not is_model_registered('payment', 'Source'):
    class Source(abstract_models.AbstractSource):
        pass

    __all__.append('Source')


if not is_model_registered('payment', 'SourceType'):
    class SourceType(abstract_models.AbstractSourceType):
        pass

    __all__.append('SourceType')


if not is_model_registered('payment', 'Bankcard'):
    class Bankcard(abstract_models.AbstractBankcard):
        pass
Example #4
0
from abstract_models import AbstractRollingAd
from oscar.core.loading import is_model_registered

__all__ = []

__APP_LABEL__ = 'ad'
if not is_model_registered(__APP_LABEL__, 'RollingAd'):

    class RollingAd(AbstractRollingAd):
        pass

    __all__.append('RollingAd')
Example #5
0
import django

from oscar.core.loading import is_model_registered
from oscar.apps.analytics.abstract_models import (
    AbstractProductRecord, AbstractUserRecord,
    AbstractUserProductView, AbstractUserSearch)


if not is_model_registered('analytics', 'ProductRecord'):
    class ProductRecord(AbstractProductRecord):
        pass


if not is_model_registered('analytics', 'UserRecord'):
    class UserRecord(AbstractUserRecord):
        pass


if not is_model_registered('analytics', 'UserProductView'):
    class UserProductView(AbstractUserProductView):
        pass


if not is_model_registered('analytics', 'UserSearch'):
    class UserSearch(AbstractUserSearch):
        pass


if django.VERSION < (1, 7):
    from . import receivers  # noqa
Example #6
0
from oscar.apps.address.abstract_models import AbstractPartnerAddress
from apps.partner.abstract_models import (
    AbstractPartner, AbstractStockAlert, AbstractStockRecord)
from oscar.core.loading import is_model_registered

__all__ = []


if not is_model_registered('partner', 'Partner'):
    class Partner(AbstractPartner):
        pass

    __all__.append('Partner')


if not is_model_registered('partner', 'PartnerAddress'):
    class PartnerAddress(AbstractPartnerAddress):
        pass

    __all__.append('PartnerAddress')


if not is_model_registered('partner', 'StockRecord'):
    class StockRecord(AbstractStockRecord):
        pass

    __all__.append('StockRecord')


if not is_model_registered('partner', 'StockAlert'):
    class StockAlert(AbstractStockAlert):
Example #7
0
from oscar.core.loading import is_model_registered

from hooks import abstract_models
from django.db.models.signals import post_save, post_delete
from django.dispatch import receiver

if not is_model_registered('hooks', 'Hook'):
    class Hook(abstract_models.AbstractHook):
        pass

if not is_model_registered('hooks', 'HookEvent'):
    class HookEvent(abstract_models.AbstractHookEvent):
        pass

if not is_model_registered('hooks', 'HookLog'):
    class HookLog(abstract_models.AbstractHookLog):
        pass

if not is_model_registered('hooks', 'HookSignalType'):
    class HookSignalType(abstract_models.AbstractSignalType):
        pass


@receiver(post_save, sender=HookEvent, dispatch_uid="update_hookevent_count")
@receiver(post_delete, sender=HookEvent, dispatch_uid="delete_hookevent_count")
def update_hookevent_count(sender, instance, **kwargs):
    count = HookEvent.objects.all().filter(hook=instance.hook.pk).count()
    instance.hook.event_count = count
    instance.hook.save()
Example #8
0
from oscar.core.loading import is_model_registered

from oscar_invoices import app_settings
from oscar_invoices.abstract_models import AbstractInvoice, AbstractLegalEntity, AbstractLegalEntityAddress

__all__ = []

is_custom_invoice_model = app_settings.OSCAR_INVOICES_INVOICE_MODEL != 'oscar_invoices.Invoice'


if not is_model_registered('oscar_invoices', 'Invoice') and not is_custom_invoice_model:
    class Invoice(AbstractInvoice):
        pass

    __all__.append('Invoice')


if not is_model_registered('oscar_invoices', 'LegalEntity'):
    class LegalEntity(AbstractLegalEntity):
        pass

    __all__.append('LegalEntity')


if not is_model_registered('oscar_invoices', 'LegalEntityAddress'):
    class LegalEntityAddress(AbstractLegalEntityAddress):
        pass

    __all__.append('LegalEntityAddress')
Example #9
0
from oscar.apps.basket.abstract_models import (AbstractBasket, AbstractLine,
                                               AbstractLineAttribute)
from oscar.core.loading import is_model_registered

__all__ = [
    'InvalidBasketLineError',
]


class InvalidBasketLineError(Exception):
    pass


if not is_model_registered('basket', 'Basket'):

    class Basket(AbstractBasket):  # abstract_modelsで定義したクラスを継承
        pass

    __all__.append('Basket')

if not is_model_registered('basket', 'Line'):  # 第一引数:app_label、第二引数:モデル名
    """
    basketアプリのテーブルににLineクラスで定義したテーブルが作成されていなかった場合に処理
    """
    class Line(AbstractLine):
        pass

    __all__.append('Line')

if not is_model_registered('basket', 'LineAttribute'):
Example #10
0
from abstract_models import AbstractRollingAd
from oscar.core.loading import is_model_registered

__all__ = []

__APP_LABEL__ = 'ad'
if not is_model_registered(__APP_LABEL__, 'RollingAd'):
    class RollingAd(AbstractRollingAd):
        pass
    __all__.append('RollingAd')
Example #11
0
"""
Vanilla product models
"""
from oscar.apps.catalogue.abstract_models import *  # noqa
from oscar.core.loading import is_model_registered

__all__ = ['ProductAttributesContainer']

if not is_model_registered('catalogue', 'Category'):

    class Category(AbstractCategory):
        pass

    __all__.append('Category')

if not is_model_registered('catalogue', 'ProductCategory'):

    class ProductCategory(AbstractProductCategory):
        pass

    __all__.append('ProductCategory')

if not is_model_registered('catalogue', 'Product'):

    class Product(AbstractProduct):
        pass

    __all__.append('Product')

if not is_model_registered('catalogue', 'ProductRecommendation'):
Example #12
0
"""
Vanilla product models
"""
from oscar.apps.catalogue.abstract_models import *  # noqa
from oscar.core.loading import is_model_registered



__all__ = ['ProductAttributesContainer']


if not is_model_registered('catalogue', 'ProductClass'):
    class ProductClass(AbstractProductClass):
        pass

    __all__.append('ProductClass')


if not is_model_registered('catalogue', 'Category'):
    class Category(AbstractCategory):
        pass

    __all__.append('Category')


if not is_model_registered('catalogue', 'ProductCategory'):
    class ProductCategory(AbstractProductCategory):
        pass

    __all__.append('ProductCategory')
Example #13
0
from oscar.core.loading import is_model_registered
from oscar.apps.shipping import abstract_models

__all__ = []


if not is_model_registered('shipping', 'OrderAndItemCharges'):
    class OrderAndItemCharges(abstract_models.AbstractOrderAndItemCharges):
        pass

    __all__.append('OrderAndItemCharges')


if not is_model_registered('shipping', 'WeightBased'):
    class WeightBased(abstract_models.AbstractWeightBased):
        pass

    __all__.append('WeightBased')


if not is_model_registered('shipping', 'WeightBand'):
    class WeightBand(abstract_models.AbstractWeightBand):
        pass

    __all__.append('WeightBand')
Example #14
0
from oscar.core.loading import is_model_registered

from oscar_accounts import abstract_models

if not is_model_registered('oscar_accounts', 'AccountType'):

    class AccountType(abstract_models.AccountType):
        pass


if not is_model_registered('oscar_accounts', 'Account'):

    class Account(abstract_models.Account):
        pass


if not is_model_registered('oscar_accounts', 'Transfer'):

    class Transfer(abstract_models.Transfer):
        pass


if not is_model_registered('oscar_accounts', 'Transaction'):

    class Transaction(abstract_models.Transaction):
        pass


if not is_model_registered('oscar_accounts', 'IPAddressRecord'):

    class IPAddressRecord(abstract_models.IPAddressRecord):
Example #15
0
from oscar.core.loading import is_model_registered

from .abstract_models import *  # noqa

__all__ = []

if not is_model_registered('communication', 'Email'):

    class Email(AbstractEmail):
        pass

    __all__.append('Email')

if not is_model_registered('communication', 'CommunicationEventType'):

    class CommunicationEventType(AbstractCommunicationEventType):
        pass

    __all__.append('CommunicationEventType')

if not is_model_registered('communication', 'Notification'):

    class Notification(AbstractNotification):
        pass

    __all__.append('Notification')
Example #16
0
from oscar.core.loading import is_model_registered

from oscar.apps.payment import abstract_models

__all__ = []

if not is_model_registered('payment', 'Transaction'):

    class Transaction(abstract_models.AbstractTransaction):
        pass

    __all__.append('Transaction')

if not is_model_registered('payment', 'Source'):

    class Source(abstract_models.AbstractSource):
        pass

    __all__.append('Source')

if not is_model_registered('payment', 'SourceType'):

    class SourceType(abstract_models.AbstractSourceType):
        pass

    __all__.append('SourceType')

if not is_model_registered('payment', 'Bankcard'):

    class Bankcard(abstract_models.AbstractBankcard):
        pass
Example #17
0
from oscar.core.loading import is_model_registered

from . import abstract_models

__all__ = []

if not is_model_registered('stores', 'StoreAddress'):

    class StoreAddress(abstract_models.StoreAddress):
        pass

    __all__.append('StoreAddress')

if not is_model_registered('stores', 'StoreGroup'):

    class StoreGroup(abstract_models.StoreGroup):
        pass

    __all__.append('StoreGroup')

if not is_model_registered('stores', 'Store'):

    class Store(abstract_models.Store):
        pass

    __all__.append('Store')

if not is_model_registered('stores', 'OpeningPeriod'):

    class OpeningPeriod(abstract_models.OpeningPeriod):
        pass
Example #18
0
import django

from oscar.core.loading import is_model_registered
from oscar.apps.address.abstract_models import AbstractPartnerAddress
from oscar.apps.partner.abstract_models import (
    AbstractPartner, AbstractStockRecord, AbstractStockAlert)


if not is_model_registered('partner', 'Partner'):
    class Partner(AbstractPartner):
        pass


if not is_model_registered('partner', 'PartnerAddress'):
    class PartnerAddress(AbstractPartnerAddress):
        pass


if not is_model_registered('partner', 'StockRecord'):
    class StockRecord(AbstractStockRecord):
        pass


if not is_model_registered('partner', 'StockAlert'):
    class StockAlert(AbstractStockAlert):
        pass


if django.VERSION < (1, 7):
    from . import receivers  # noqa
Example #19
0
from oscar.apps.address.abstract_models import AbstractInvestorAddress
from oscar.apps.investor.abstract_models import (AbstractInvestor,
                                                 AbstractInvestment,
                                                 AbstractInvestmentComment,
                                                 AbstractProjectAnnouncement)
from oscar.core.loading import is_model_registered

__all__ = []

if not is_model_registered('investor', 'Investor'):

    class Investor(AbstractInvestor):
        pass

    __all__.append('Investor')

if not is_model_registered('investor', 'InvestorAddress'):

    class InvestorAddress(AbstractInvestorAddress):
        pass

    __all__.append('InvestorAddress')

if not is_model_registered('investor', 'Investment'):

    class Investment(AbstractInvestment):
        pass

    __all__.append('Investment')

if not is_model_registered('investor', 'InvestmentComment'):
Example #20
0
from oscar.apps.catalogue.reviews.abstract_models import (
    AbstractProductReview, AbstractVote)
from oscar.core.loading import is_model_registered

if not is_model_registered('reviews', 'ProductReview'):

    class ProductReview(AbstractProductReview):
        pass


if not is_model_registered('reviews', 'Vote'):

    class Vote(AbstractVote):
        pass
Example #21
0
from oscar.apps.address.abstract_models import AbstractCompanyAddress
from oscar.apps.company.abstract_models import  AbstractCompany, AbstractCompanyProspectus
from oscar.core.loading import is_model_registered

__all__ = []


if not is_model_registered('company', 'Company'):
    class Company(AbstractCompany):
        pass

    __all__.append('Company')


if not is_model_registered('Company', 'CompanyAddress'):
    class CompanyAddress(AbstractCompanyAddress):
        pass

    __all__.append('CompanyAddress')


if not is_model_registered('Company', 'CompanyProspectus'):
    class CompanyProspectus(AbstractCompanyProspectus):
        pass

    __all__.append('CompanyProspectus')

Example #22
0
from oscar.apps.basket.abstract_models import (AbstractBasket, AbstractLine,
                                               AbstractLineAttribute)
from oscar.core.loading import is_model_registered

__all__ = [
    'InvalidBasketLineError',
]


class InvalidBasketLineError(Exception):
    pass


if not is_model_registered('basket', 'Basket'):

    class Basket(AbstractBasket):
        pass

    __all__.append('Basket')

if not is_model_registered('basket', 'Line'):

    class Line(AbstractLine):
        pass

    __all__.append('Line')

if not is_model_registered('basket', 'LineAttribute'):

    class LineAttribute(AbstractLineAttribute):
        pass
Example #23
0
# -*- coding: utf-8 -*-
from oscar.core.loading import is_model_registered

from .abstract_models import *  # noqa

__all__ = []


if not is_model_registered('wishlists', 'WishList'):
    class WishList(AbstractWishList):
        pass

    __all__.append('WishList')


if not is_model_registered('wishlists', 'Line'):
    class Line(AbstractLine):
        pass

    __all__.append('Line')
Example #24
0
from oscar.apps.voucher.abstract_models import (AbstractVoucher,
                                                AbstractVoucherApplication,
                                                AbstractVoucherSet)
from oscar.core.loading import is_model_registered

__all__ = []

if not is_model_registered('voucher', 'VoucherSet'):

    class VoucherSet(AbstractVoucherSet):
        pass

    __all__.append('VoucherSet')

if not is_model_registered('voucher', 'Voucher'):

    class Voucher(AbstractVoucher):
        pass

    __all__.append('Voucher')

if not is_model_registered('voucher', 'VoucherApplication'):

    class VoucherApplication(AbstractVoucherApplication):
        pass

    __all__.append('VoucherApplication')
Example #25
0
from oscar.apps.customer import abstract_models
from oscar.core.loading import is_model_registered

__all__ = []


if not is_model_registered('customer', 'Email'):
    class Email(abstract_models.AbstractEmail):
        pass

    __all__.append('Email')


if not is_model_registered('customer', 'CommunicationEventType'):
    class CommunicationEventType(
            abstract_models.AbstractCommunicationEventType):
        pass

    __all__.append('CommunicationEventType')


if not is_model_registered('customer', 'Notification'):
    class Notification(abstract_models.AbstractNotification):
        pass

    __all__.append('Notification')


if not is_model_registered('customer', 'ProductAlert'):
    class ProductAlert(abstract_models.AbstractProductAlert):
        pass
from oscar.core.loading import is_model_registered

from . import abstract_models


__all__ = []


if not is_model_registered('stores', 'StoreAddress'):
    class StoreAddress(abstract_models.StoreAddress):
        pass

    __all__.append('StoreAddress')


if not is_model_registered('stores', 'StoreGroup'):
    class StoreGroup(abstract_models.StoreGroup):
        pass

    __all__.append('StoreGroup')


if not is_model_registered('stores', 'Store'):
    class Store(abstract_models.Store):
        pass

    __all__.append('Store')


if not is_model_registered('stores', 'OpeningPeriod'):
    class OpeningPeriod(abstract_models.OpeningPeriod):
Example #27
0
    class Admin:
        pass

    class Meta:
        ordering = ('-version_number', )


def get_tree(task):
    "Given a task return its sub task hiearchy"
    task_list = []
    subt = task.task_set.all()
    for task in subt:
        task_list.append(task)
        children = get_tree(task)
        if children:
            task_list.append(children)
    return task_list


from oscar.core.loading import is_model_registered

__all__ = []

if not is_model_registered('project', 'LinkedProject'):

    class LinkedProject(Project):
        pass

    __all__.append('LinkedProject')
Example #28
0
# -*- coding: utf-8 -*-
from oscar.core.loading import is_model_registered
from oscar_ficta.invoice.abstract_models import (
    AbstractInvoice, 
    )

__all__ = []


if not is_model_registered('oscar_ficta.invoice', 'Invoice'):
    class Invoice(AbstractInvoice):
        pass

    __all__.append('Invoice')
Example #29
0
from oscar.apps.voucher.abstract_models import (
    AbstractVoucher, AbstractVoucherApplication)
from oscar.core.loading import is_model_registered

__all__ = []


if not is_model_registered('voucher', 'Voucher'):
    class Voucher(AbstractVoucher):
        pass

    __all__.append('Voucher')


if not is_model_registered('voucher', 'VoucherApplication'):
    class VoucherApplication(AbstractVoucherApplication):
        pass

    __all__.append('VoucherApplication')
Example #30
0
from oscar.apps.address.abstract_models import (AbstractBillingAddress,
                                                AbstractShippingAddress)
from oscar.apps.order.abstract_models import *  # noqa
from oscar.core.loading import is_model_registered

__all__ = ['PaymentEventQuantity', 'ShippingEventQuantity']

if not is_model_registered('order', 'Order'):

    class Order(AbstractOrder):
        pass

    __all__.append('Order')

if not is_model_registered('order', 'OrderNote'):

    class OrderNote(AbstractOrderNote):
        pass

    __all__.append('OrderNote')

if not is_model_registered('order', 'OrderStatusChange'):

    class OrderStatusChange(AbstractOrderStatusChange):
        pass

    __all__.append('OrderStatusChange')

if not is_model_registered('order', 'CommunicationEvent'):

    class CommunicationEvent(AbstractCommunicationEvent):
Example #31
0
from oscar.apps.customer import abstract_models
from oscar.core.loading import is_model_registered

__all__ = []

if not is_model_registered('customer', 'ProductAlert'):

    class ProductAlert(abstract_models.AbstractProductAlert):
        pass

    __all__.append('ProductAlert')
Example #32
0
from oscar.apps.catalogue.reviews.abstract_models import (
    AbstractProductReview, AbstractVote)
from oscar.core.loading import is_model_registered

if not is_model_registered('reviews', 'ProductReview'):
    class ProductReview(AbstractProductReview):
        pass


if not is_model_registered('reviews', 'Vote'):
    class Vote(AbstractVote):
        pass
Example #33
0
from oscar.apps.address.abstract_models import (
    AbstractBillingAddress, AbstractShippingAddress)
from oscar.apps.order.abstract_models import *  # noqa
from oscar.core.loading import is_model_registered

__all__ = ['PaymentEventQuantity', 'ShippingEventQuantity']


if not is_model_registered('order', 'Order'):
    class Order(AbstractOrder):
        pass

    __all__.append('Order')


if not is_model_registered('order', 'OrderNote'):
    class OrderNote(AbstractOrderNote):
        pass

    __all__.append('OrderNote')


if not is_model_registered('order', 'CommunicationEvent'):
    class CommunicationEvent(AbstractCommunicationEvent):
        pass

    __all__.append('CommunicationEvent')


if not is_model_registered('order', 'ShippingAddress'):
    class ShippingAddress(AbstractShippingAddress):
Example #34
0
from oscar.core.loading import is_model_registered
from oscar.apps.shipping import abstract_models

if not is_model_registered('shipping', 'OrderAndItemCharges'):

    class OrderAndItemCharges(abstract_models.AbstractOrderAndItemCharges):
        pass


if not is_model_registered('shipping', 'WeightBased'):

    class WeightBased(abstract_models.AbstractWeightBased):
        pass


if not is_model_registered('shipping', 'WeightBand'):

    class WeightBand(abstract_models.AbstractWeightBand):
        pass
from oscar.core.loading import is_model_registered

from oscar_accounts import abstract_models

if not is_model_registered('oscar_accounts', 'AccountType'):
    class AccountType(abstract_models.AccountType):
        pass


if not is_model_registered('oscar_accounts', 'Account'):
    class Account(abstract_models.Account):
        pass


if not is_model_registered('oscar_accounts', 'Transfer'):
    class Transfer(abstract_models.Transfer):
        pass


if not is_model_registered('oscar_accounts', 'Transaction'):
    class Transaction(abstract_models.Transaction):
        pass


if not is_model_registered('oscar_accounts', 'IPAddressRecord'):
    class IPAddressRecord(abstract_models.IPAddressRecord):
        pass
Example #36
0
from oscar.apps.offer.abstract_models import (
    AbstractBenefit, AbstractCondition, AbstractConditionalOffer,
    AbstractRange, AbstractRangeProduct, AbstractRangeProductFileUpload)
from oscar.apps.offer.results import (
    SHIPPING_DISCOUNT, ZERO_DISCOUNT, BasketDiscount, PostOrderAction,
    ShippingDiscount)
from oscar.core.loading import is_model_registered

__all__ = [
    'BasketDiscount', 'ShippingDiscount', 'PostOrderAction',
    'SHIPPING_DISCOUNT', 'ZERO_DISCOUNT'
]


if not is_model_registered('offer', 'ConditionalOffer'):
    class ConditionalOffer(AbstractConditionalOffer):
        pass

    __all__.append('ConditionalOffer')


if not is_model_registered('offer', 'Benefit'):
    class Benefit(AbstractBenefit):
        pass

    __all__.append('Benefit')


if not is_model_registered('offer', 'Condition'):
    class Condition(AbstractCondition):
        pass
Example #37
0
from oscar.apps.address.abstract_models import (
    AbstractCountry, AbstractUserAddress)
from oscar.core.loading import is_model_registered

__all__ = []


if not is_model_registered('address', 'UserAddress'):
    class UserAddress(AbstractUserAddress):
        pass

    __all__.append('UserAddress')


if not is_model_registered('address', 'Country'):
    class Country(AbstractCountry):
        pass

    __all__.append('Country')
Example #38
0
"""
Vanilla product models
"""
from oscar.apps.catalogue.abstract_models import *  # noqa
from oscar.core.loading import is_model_registered

__all__ = ['ProductAttributesContainer']

if not is_model_registered('catalogue', 'ProductClass'):

    class ProductClass(AbstractProductClass):
        pass

    __all__.append('ProductClass')

if not is_model_registered('catalogue', 'Category'):

    class Category(AbstractCategory):
        pass

    __all__.append('Category')

if not is_model_registered('catalogue', 'ProductCategory'):

    class ProductCategory(AbstractProductCategory):
        pass

    __all__.append('ProductCategory')

if not is_model_registered('catalogue', 'Product'):
Example #39
0
# -*- coding: utf-8 -*-
from oscar.core.loading import is_model_registered

from .abstract_models import *  # noqa


if not is_model_registered('wishlists', 'WishList'):
    class WishList(AbstractWishList):
        pass


if not is_model_registered('wishlists', 'Line'):
    class Line(AbstractLine):
        pass
Example #40
0
from oscar.apps.offer.abstract_models import (
    AbstractBenefit, AbstractCondition, AbstractConditionalOffer,
    AbstractRange, AbstractRangeProduct, AbstractRangeProductFileUpload)
from oscar.apps.offer.results import (SHIPPING_DISCOUNT, ZERO_DISCOUNT,
                                      BasketDiscount, PostOrderAction,
                                      ShippingDiscount)
from oscar.core.loading import is_model_registered

__all__ = [
    'BasketDiscount', 'ShippingDiscount', 'PostOrderAction',
    'SHIPPING_DISCOUNT', 'ZERO_DISCOUNT'
]

if not is_model_registered('offer', 'ConditionalOffer'):

    class ConditionalOffer(AbstractConditionalOffer):
        pass

    __all__.append('ConditionalOffer')

if not is_model_registered('offer', 'Benefit'):

    class Benefit(AbstractBenefit):
        pass

    __all__.append('Benefit')

if not is_model_registered('offer', 'Condition'):

    class Condition(AbstractCondition):
        pass
Example #41
0
from oscar.apps.customer import abstract_models
from oscar.core.loading import is_model_registered
from django.conf import settings
settings.EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
settings.EMAIL_USE_TLS = True
settings.EMAIL_HOST = 'smtp.gmail.com'
settings.EMAIL_PORT = 587
settings.OSCAR_FROM_EMAIL = '*****@*****.**'
settings.EMAIL_HOST_USER = '******'
settings.EMAIL_HOST_PASSWORD = '******'

from django.core.mail import send_mail

__all__ = []

if not is_model_registered('customer', 'Email'):
    print "here"
    class Email(abstract_models.AbstractEmail):
        def save(self, *args, **kwargs):
            super(Email, self).save(*args, **kwargs)

            send_mail(self.subject, 
                self.body_text, 
                settings.OSCAR_FROM_EMAIL, 
                [self.email], 
                fail_silently=False)

    __all__.append('Email')


if not is_model_registered('customer', 'CommunicationEventType'):
Example #42
0
from .constants import ES_CTX_PUBLIC, ES_CTX_AVAILABLE, ES_CTX_BROWSABLE
from . import settings

merge_dicts, es_type_for_product_attribute, product_attributes_es_config = get_classes(
    "search.utils",
    [
        "merge_dicts", "es_type_for_product_attribute",
        "product_attributes_es_config"
    ],
)
process_product_fields = get_class("search.extra", "process_product_fields")
ProductProxyMixin = get_class("search.mixins", "ProductProxyMixin")

__all__ = []

if is_model_registered("catalogue", "Product"):

    class ProductProxy(get_model("catalogue", "Product"), ProductProxyMixin):
        def popularity(self):
            months_to_run = settings.MONTHS_TO_RUN_ANALYTICS
            orders_above_date = timezone.now() - relativedelta(
                months=months_to_run)

            Line = get_model("order", "Line")

            return Line.objects.filter(
                product=self,
                order__date_placed__gte=orders_above_date).count()

        @cached_property
        def purchase_info(self):
Example #43
0
# -*- coding: utf-8 -*-
from oscar.core.loading import is_model_registered
from oscar_ficta.abstract_models import (
    AbstractPersonGroup, 
    AbstractLegalAddress, 
    AbstractPerson, 
    AbstractBankAccount, 
    AbstractBank)

__all__ = []


if not is_model_registered('oscar_ficta', 'PersonGroup'):
    class PersonGroup(AbstractPersonGroup):
        pass

    __all__.append('PersonGroup')


if not is_model_registered('oscar_ficta', 'LegalAddress'):
    class LegalAddress(AbstractLegalAddress):
        pass

    __all__.append('LegalAddress')
    

if not is_model_registered('oscar_ficta', 'Person'):
    class Person(AbstractPerson):
        pass

    __all__.append('Person')
Example #44
0
from django.db import models

from oscar.core.loading import is_model_registered
from oscar.apps.address.abstract_models import (
    AbstractUserAddress, AbstractCountry)

__all__ = []


if not is_model_registered('address', 'UserAddress'):
    class UserAddress(AbstractUserAddress):
        pass

    __all__.append('UserAddress')


if not is_model_registered('address', 'Country'):
    class Country(AbstractCountry):
        pass

    __all__.append('Country')
Example #45
0
from oscar.core.loading import is_model_registered
from oscar.apps.basket.abstract_models import (
    AbstractBasket, AbstractLine, AbstractLineAttribute)

__all__ = [
    'InvalidBasketLineError',
]


class InvalidBasketLineError(Exception):
    pass


if not is_model_registered('basket', 'Basket'):
    class Basket(AbstractBasket):
        pass

    __all__.append('Basket')


if not is_model_registered('basket', 'Line'):
    class Line(AbstractLine):
        pass

    __all__.append('Line')


if not is_model_registered('basket', 'LineAttribute'):
    class LineAttribute(AbstractLineAttribute):
        pass
Example #46
0
from oscar.apps.customer import abstract_models
from oscar.core.loading import is_model_registered

__all__ = []

if not is_model_registered('customer', 'Email'):

    class Email(abstract_models.AbstractEmail):
        pass

    __all__.append('Email')

if not is_model_registered('customer', 'CommunicationEventType'):

    class CommunicationEventType(abstract_models.AbstractCommunicationEventType
                                 ):
        pass

    __all__.append('CommunicationEventType')

if not is_model_registered('customer', 'Notification'):

    class Notification(abstract_models.AbstractNotification):
        pass

    __all__.append('Notification')

if not is_model_registered('customer', 'ProductAlert'):

    class ProductAlert(abstract_models.AbstractProductAlert):
        pass
Example #47
0
from oscar.apps.customer.reviews.abstract_models import (AbstractVendorReview,
                                                         AbstractVote)
from oscar.core.loading import is_model_registered

if not is_model_registered('reviews', 'VendorReview'):

    class VendorReview(AbstractVendorReview):
        pass


if not is_model_registered('reviews', 'Vote'):

    class Vote(AbstractVote):
        pass