2017-04-02 09:14:20 +00:00
|
|
|
from django.apps import apps
|
2017-10-01 10:01:40 +00:00
|
|
|
from django.utils.module_loading import import_string
|
|
|
|
from longclaw.settings import PRODUCT_VARIANT_MODEL, PAYMENT_GATEWAY
|
2017-04-02 09:14:20 +00:00
|
|
|
|
2017-10-01 10:01:40 +00:00
|
|
|
GATEWAY = import_string(PAYMENT_GATEWAY)()
|
2017-04-02 09:14:20 +00:00
|
|
|
ProductVariant = apps.get_model(*PRODUCT_VARIANT_MODEL.split('.'))
|
2017-09-17 12:01:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
def maybe_get_product_model():
|
|
|
|
try:
|
|
|
|
field = ProductVariant._meta.get_field('product')
|
2018-12-26 11:58:05 +00:00
|
|
|
return field.related_model
|
2017-09-17 12:01:12 +00:00
|
|
|
except:
|
|
|
|
pass
|