from django.conf import settings

from airmozilla.main.models import Event


def sidebar(request):
    featured = Event.objects.approved().filter(public=True, featured=True)
    upcoming = Event.objects.upcoming().order_by('start_time')
    if not request.user.is_active:
        featured = featured.filter(public=True)
        upcoming = upcoming.filter(public=True)
    upcoming = upcoming[:settings.UPCOMING_SIDEBAR_COUNT]
    return {
        'upcoming': upcoming,
        'featured': featured
    }

from django.conf import settings

from airmozilla.main.models import Event


def sidebar(request):
    featured = Event.objects.approved().filter(featured=True)
    upcoming = Event.objects.upcoming().order_by('start_time')
    if not request.user.is_active:
        featured = featured.filter(public=True)
        upcoming = upcoming.filter(public=True)
    upcoming = upcoming[:settings.UPCOMING_SIDEBAR_COUNT]
    return {
        'upcoming': upcoming,
        'featured': featured
    }

Fix context processor to correctly display internal featured videos.
Fix context processor to correctly display internal featured videos.

  from django.conf import settings
  
  from airmozilla.main.models import Event
  
  
  def sidebar(request):
-     featured = Event.objects.approved().filter(public=True, featured=True)
+     featured = Event.objects.approved().filter(featured=True)
      upcoming = Event.objects.upcoming().order_by('start_time')
      if not request.user.is_active:
          featured = featured.filter(public=True)
          upcoming = upcoming.filter(public=True)
      upcoming = upcoming[:settings.UPCOMING_SIDEBAR_COUNT]
      return {
          'upcoming': upcoming,
          'featured': featured
      }
  
Fix context processor to correctly display internal featured videos.
## Code Before:
from django.conf import settings

from airmozilla.main.models import Event


def sidebar(request):
    featured = Event.objects.approved().filter(public=True, featured=True)
    upcoming = Event.objects.upcoming().order_by('start_time')
    if not request.user.is_active:
        featured = featured.filter(public=True)
        upcoming = upcoming.filter(public=True)
    upcoming = upcoming[:settings.UPCOMING_SIDEBAR_COUNT]
    return {
        'upcoming': upcoming,
        'featured': featured
    }

## Instruction:
Fix context processor to correctly display internal featured videos.
## Code After:
from django.conf import settings

from airmozilla.main.models import Event


def sidebar(request):
    featured = Event.objects.approved().filter(featured=True)
    upcoming = Event.objects.upcoming().order_by('start_time')
    if not request.user.is_active:
        featured = featured.filter(public=True)
        upcoming = upcoming.filter(public=True)
    upcoming = upcoming[:settings.UPCOMING_SIDEBAR_COUNT]
    return {
        'upcoming': upcoming,
        'featured': featured
    }
