from .models import Channel


def channel_context(request):
    return {'opps_menu': Channel.objects.all()}

from django.utils import timezone
from .models import Channel


def channel_context(request):
    """ Channel context processors
    """
    opps_menu = Channel.objects.filter(date_available__lte=timezone.now(),
                                       published=True)

    return {'opps_menu': opps_menu}

Apply filter channel published on menu list (channel context processors)
Apply filter channel published on menu list (channel context processors)

+ from django.utils import timezone
  from .models import Channel
  
  
  def channel_context(request):
-     return {'opps_menu': Channel.objects.all()}
+     """ Channel context processors
+     """
+     opps_menu = Channel.objects.filter(date_available__lte=timezone.now(),
+                                        published=True)
  
+     return {'opps_menu': opps_menu}
+ 
Apply filter channel published on menu list (channel context processors)
## Code Before:
from .models import Channel


def channel_context(request):
    return {'opps_menu': Channel.objects.all()}

## Instruction:
Apply filter channel published on menu list (channel context processors)
## Code After:
from django.utils import timezone
from .models import Channel


def channel_context(request):
    """ Channel context processors
    """
    opps_menu = Channel.objects.filter(date_available__lte=timezone.now(),
                                       published=True)

    return {'opps_menu': opps_menu}
