from django.shortcuts import render
from django.views.generic.detail import DetailView

from projects.models import Project
from misc.code_blocks_preprocessor import CodeBlockExtension

import markdown

class ProjectDetailView(DetailView):
    model = Project
    context_object_name='project'
    template_name = 'projects/detail.html'

    def get_context_data(self, **kwargs):
        context = super(ProjectDetailView, self).get_context_data(**kwargs)
        context['projects'] = Project.objects.order_by('priority')
        context['html'] = markdown.markdown(
                context['object'].full_descr,
                extensions=[CodeBlockExtension()])
        return context


from django.shortcuts import render
from django.views.generic.detail import DetailView

from projects.models import Project
from misc.code_blocks_preprocessor import CodeBlockExtension

import markdown

class ProjectDetailView(DetailView):
    model = Project
    context_object_name='project'
    template_name = 'projects/detail.html'

    def get_context_data(self, **kwargs):
        context = super(ProjectDetailView, self).get_context_data(**kwargs)
        context['html'] = markdown.markdown(
                context['object'].full_descr,
                extensions=[CodeBlockExtension()])
        return context


Remove unnecessary projects added to context
Remove unnecessary projects added to context

  from django.shortcuts import render
  from django.views.generic.detail import DetailView
  
  from projects.models import Project
  from misc.code_blocks_preprocessor import CodeBlockExtension
  
  import markdown
  
  class ProjectDetailView(DetailView):
      model = Project
      context_object_name='project'
      template_name = 'projects/detail.html'
  
      def get_context_data(self, **kwargs):
          context = super(ProjectDetailView, self).get_context_data(**kwargs)
-         context['projects'] = Project.objects.order_by('priority')
          context['html'] = markdown.markdown(
                  context['object'].full_descr,
                  extensions=[CodeBlockExtension()])
          return context
  
  
Remove unnecessary projects added to context
## Code Before:
from django.shortcuts import render
from django.views.generic.detail import DetailView

from projects.models import Project
from misc.code_blocks_preprocessor import CodeBlockExtension

import markdown

class ProjectDetailView(DetailView):
    model = Project
    context_object_name='project'
    template_name = 'projects/detail.html'

    def get_context_data(self, **kwargs):
        context = super(ProjectDetailView, self).get_context_data(**kwargs)
        context['projects'] = Project.objects.order_by('priority')
        context['html'] = markdown.markdown(
                context['object'].full_descr,
                extensions=[CodeBlockExtension()])
        return context


## Instruction:
Remove unnecessary projects added to context
## Code After:
from django.shortcuts import render
from django.views.generic.detail import DetailView

from projects.models import Project
from misc.code_blocks_preprocessor import CodeBlockExtension

import markdown

class ProjectDetailView(DetailView):
    model = Project
    context_object_name='project'
    template_name = 'projects/detail.html'

    def get_context_data(self, **kwargs):
        context = super(ProjectDetailView, self).get_context_data(**kwargs)
        context['html'] = markdown.markdown(
                context['object'].full_descr,
                extensions=[CodeBlockExtension()])
        return context

