title: How to create a custom mixin in django?
body: <p>I have a decorator which prevents the user from accessing URLs if the product with <code>id=1</code> is not activated.</p>
  <p>I want to create a mixin similar to this.</p>
  <p>This is my decorator:</p>
  <pre><code>from django.core.exceptions import PermissionDenied
  from ecommerce_integration.models import Product 
  
  
  def product_1_activation(function):
      def wrap(request, *args, **kwargs):
          products = Product.objects.filter(pk=1, activate=True)
          if products:
              return function(request, *args, **kwargs)
          else:
              raise PermissionDenied
      wrap.__doc__ = function.__doc__
      wrap.__name__ = function.__name__
      return wrap
  </code></pre>
  <p>Any idea how to create a custom mixin similar to the above decorator?</p>
  <p>Actually I want to create mixins for my Class Based View.</p>
  <p>Can anyone help me out in this?</p>