# Path: shopkit/core/settings.py
# MAX_NAME_LENGTH = getattr(settings, 'SHOPKIT_MAX_NAME_LENGTH', 255)
# 
# Path: shopkit/core/managers.py
# class ActiveItemManager(models.Manager):
#     """ 
#     Manager returning only activated items, ideally for subclasses of
#     :class:`AbstractActiveItemBase <shopkit.core.basemodels.AbstractActiveItemBase>`. 
#     """
# 
#     def get_query_set(self):
#         """ Filter the original queryset so it returns only items with
#             `active=True`.
#         """
#         qs = super(ActiveItemManager, self).get_query_set()
#         qs = qs.filter(active=True)
# 
#         return qs


import logging
import datetime
from django.utils.translation import ugettext_lazy as _
from django.db import models
from shopkit.core.settings import MAX_NAME_LENGTH
from shopkit.core.managers import ActiveItemManager
    )


class ActiveItemBase(models.Model):
    """
    Abstract base class for items which can be activated or deactivated.
    """

    class Meta:
        abstract = True

    active = models.BooleanField(verbose_name=_('active'),
                                 default=True, db_index=True)
    """ Whether the item is active in the frontend. """


class ActiveItemInShopBase(ActiveItemBase):
    """
    This is a subclass of :class:`ActiveItemBase` with an
    :class:`ActiveItemManager <shopkit.core.managers.ActiveItemManager>`
    called `in_shop` returning only items with `active=True`.

    The main purpose of this class is allowing for items to be enabled or
    disabled in the shop's backend.
    """

    class Meta:
        abstract = True

    objects = models.Manager()

# Path: shopkit/core/settings.py
# MAX_NAME_LENGTH = getattr(settings, 'SHOPKIT_MAX_NAME_LENGTH', 255)
# 
# Path: shopkit/core/managers.py
# class ActiveItemManager(models.Manager):
#     """ 
#     Manager returning only activated items, ideally for subclasses of
#     :class:`AbstractActiveItemBase <shopkit.core.basemodels.AbstractActiveItemBase>`. 
#     """
# 
#     def get_query_set(self):
#         """ Filter the original queryset so it returns only items with
#             `active=True`.
#         """
#         qs = super(ActiveItemManager, self).get_query_set()
#         qs = qs.filter(active=True)
# 
#         return qs


# Path: shopkit/core/basemodels.py
import logging
import datetime
from django.utils.translation import ugettext_lazy as _
from django.db import models
from shopkit.core.settings import MAX_NAME_LENGTH
from shopkit.core.managers import ActiveItemManager

    )


class ActiveItemBase(models.Model):
    """
    Abstract base class for items which can be activated or deactivated.
    """

    class Meta:
        abstract = True

    active = models.BooleanField(verbose_name=_('active'),
                                 default=True, db_index=True)
    """ Whether the item is active in the frontend. """


class ActiveItemInShopBase(ActiveItemBase):
    """
    This is a subclass of :class:`ActiveItemBase` with an
    :class:`ActiveItemManager <shopkit.core.managers.ActiveItemManager>`
    called `in_shop` returning only items with `active=True`.

    The main purpose of this class is allowing for items to be enabled or
    disabled in the shop's backend.
    """

    class Meta:
        abstract = True

    objects = models.Manager()

    in_shop = ActiveItemManager()