def test_django_14(self):
     # django_14 test
     from mock import patch, Mock
     from moderation.utils import django_14
     version = Mock()
     version.return_value = '1.4.8'
     with patch('django.get_version', version):
         self.assertTrue(django_14())
示例#2
0
 def test_django_14(self):
     # django_14 test
     from mock import patch, Mock
     from moderation.utils import django_14
     version = Mock()
     version.return_value = '1.4.8'
     with patch('django.get_version', version):
         self.assertTrue(django_14())
                '%sModerator' % cls.__name__,
                (GenericModerator,),
                attrs,
            )
        else:
            return None

    def __init__(cls, name, bases, clsdict):
        """
        Registers ``ModeratedModel``

        """
        super(ModeratedModelBase, cls).__init__(name, bases, clsdict)

        if (any(x.__name__ == 'ModeratedModel' for x in cls.mro()[1:])):
            moderation.register(cls, cls._resolve_moderator())


class ModelBase(ModeratedModelBase, base.ModelBase):
    """
    Common metaclass for ``ModeratedModel`` enabling it to inherit
    the behavior of django ``Model`` objects

    """

if not django_14():
    # django.utils.six.with_metaclass is broken in django < 1.5
    class ModeratedModel(with_metaclass(ModelBase, base.Model)):
        class Meta:
            abstract = True
示例#4
0
                (GenericModerator, ),
                attrs,
            )
        else:
            return None

    def __init__(cls, name, bases, clsdict):
        """
        Registers ``ModeratedModel``

        """
        super(ModeratedModelBase, cls).__init__(name, bases, clsdict)

        if (any(x.__name__ == 'ModeratedModel' for x in cls.mro()[1:])):
            moderation.register(cls, cls._resolve_moderator())


class ModelBase(ModeratedModelBase, base.ModelBase):
    """
    Common metaclass for ``ModeratedModel`` enabling it to inherit
    the behavior of django ``Model`` objects

    """


if not django_14():
    # django.utils.six.with_metaclass is broken in django < 1.5
    class ModeratedModel(with_metaclass(ModelBase, base.Model)):
        class Meta:
            abstract = True