# Path: boardinghouse/schema.py
# def is_shared_model(model):
#     """
#     Is the model (or instance of a model) one that should be in the
#     public/shared schema?
#     """
#     if model._is_shared_model:
#         return True
# 
#     app_model = '{m.app_label}.{m.model_name}'.format(m=model._meta).lower()
# 
#     # These should be case insensitive!
#     if app_model in REQUIRED_SHARED_MODELS:
#         return True
# 
#     if app_model in [x.lower() for x in settings.SHARED_MODELS]:
#         return True
# 
#     # Sometimes, we want a join table to be private.
#     if app_model in [x.lower() for x in settings.PRIVATE_MODELS]:
#         return False
# 
#     # if all fields are auto or fk, then we are a join model,
#     # and if all related objects are shared, then we must
#     # also be shared, unless we were explicitly marked as private
#     # above.
#     if _is_join_model(model):
#         return all(
#             is_shared_model(field.remote_field.model)
#             for field in model._meta.fields
#             if field.remote_field
#         )
# 
#     return False
# 
# Path: boardinghouse/signals.py



from django import template
from ..schema import is_shared_model as _is_shared_model
from ..signals import find_schema


register = template.Library()


@register.filter
def is_schema_aware(obj):
    return obj and not _is_shared_model(obj)


@register.filter
def is_shared_model(obj):

# Path: boardinghouse/schema.py
# def is_shared_model(model):
#     """
#     Is the model (or instance of a model) one that should be in the
#     public/shared schema?
#     """
#     if model._is_shared_model:
#         return True
# 
#     app_model = '{m.app_label}.{m.model_name}'.format(m=model._meta).lower()
# 
#     # These should be case insensitive!
#     if app_model in REQUIRED_SHARED_MODELS:
#         return True
# 
#     if app_model in [x.lower() for x in settings.SHARED_MODELS]:
#         return True
# 
#     # Sometimes, we want a join table to be private.
#     if app_model in [x.lower() for x in settings.PRIVATE_MODELS]:
#         return False
# 
#     # if all fields are auto or fk, then we are a join model,
#     # and if all related objects are shared, then we must
#     # also be shared, unless we were explicitly marked as private
#     # above.
#     if _is_join_model(model):
#         return all(
#             is_shared_model(field.remote_field.model)
#             for field in model._meta.fields
#             if field.remote_field
#         )
# 
#     return False
# 
# Path: boardinghouse/signals.py



# Path: boardinghouse/templatetags/boardinghouse.py
from django import template
from ..schema import is_shared_model as _is_shared_model
from ..signals import find_schema



register = template.Library()


@register.filter
def is_schema_aware(obj):
    return obj and not _is_shared_model(obj)


@register.filter
def is_shared_model(obj):

    return obj and _is_shared_model(obj)