old_contents: #!/usr/bin/env python
  # -*- coding: utf-8 -*-
  from django.views.generic.detail import DetailView as DjangoDetailView
  from django.contrib.sites.models import get_current_site
  from django.utils import timezone
  
  from opps.views.generic.base import View
  
  
  class DetailView(View, DjangoDetailView):
  
      def get_template_names(self):
          templates = []
  
          domain_folder = self.get_template_folder()
  
  
          templates.append('{}/{}/{}/detail.html'.format(domain_folder,
                                                         self.long_slug,
                                                         self.slug))
          templates.append('{}/{}/detail.html'.format(domain_folder,
                                                      self.long_slug))
          templates.append('{}/detail.html'.format(domain_folder))
  
          return templates
  
      def get_queryset(self):
          self.site = get_current_site(self.request)
          self.slug = self.kwargs.get('slug')
          self.long_slug = self.get_long_slug()
          if not self.long_slug:
              return None
  
          self.set_channel_rules()
  
          filters = {}
          filters['site_domain'] = self.site.domain
          filters['channel_long_slug'] = self.long_slug
          filters['slug'] = self.slug
  
          preview_enabled = self.request.user and self.request.user.is_staff
  
          if not preview_enabled:
              filters['date_available__lte'] = timezone.now()
              filters['published'] = True
  
          queryset = super(DetailView, self).get_queryset()
          return queryset.filter(**filters)._clone()
  
new_contents: #!/usr/bin/env python
  # -*- coding: utf-8 -*-
  from django.views.generic.detail import DetailView as DjangoDetailView
  from django.contrib.sites.models import get_current_site
  from django.utils import timezone
  
  from opps.views.generic.base import View
  
  
  class DetailView(View, DjangoDetailView):
  
      def get_template_names(self):
          templates = []
          domain_folder = self.get_template_folder()
  
          templates.append('{}/{}/{}/detail.html'.format(domain_folder,
                                                         self.long_slug,
                                                         self.slug))
          templates.append('{}/{}/detail.html'.format(domain_folder,
                                                      self.long_slug))
          templates.append('{}/detail.html'.format(domain_folder))
  
          return templates
  
      def get_queryset(self):
          self.site = get_current_site(self.request)
          self.slug = self.kwargs.get('slug')
          self.long_slug = self.get_long_slug()
          if not self.long_slug:
              return None
  
          self.set_channel_rules()
  
          filters = {}
          filters['site_domain'] = self.site.domain
          filters['channel_long_slug'] = self.long_slug
          filters['slug'] = self.slug
  
          preview_enabled = self.request.user and self.request.user.is_staff
  
          if not preview_enabled:
              filters['date_available__lte'] = timezone.now()
              filters['published'] = True
  
          queryset = super(DetailView, self).get_queryset()
          return queryset.filter(**filters)._clone()
  
subject: Fix pep8, remove blank line on DetailView