# pylint: disable=W0614,W0401
from oscar.core.loading import get_class, is_model_registered

AbstractUserAddress = get_class("address.abstract_models", "AbstractUserAddress")

__all__ = []


if not is_model_registered("address", "UserAddress"):

    class UserAddress(AbstractUserAddress):
        pass

    __all__.append("UserAddress")


# both these lines are reruired, the first one imports all objects the are not
# implemented above into the current namespace.
# the second line updates the __all__ variable of the current namespace with
# the objects from the oscar namespace.
# THIS ENSURE THAT THE SAME CAN BE DONE BY ANOTHER APP, SO THIS APP CAN BE ONCE
# MORE EXTENDED BY ANOTHER APP.
from oscar.apps.address.models import *  # noqa
from oscar.apps.address.models import __all__ as some

__all__.extend(some)
