from django.shortcuts import render
from .models import Photos
from django.views.generic import TemplateView


class IndexView(TemplateView):
    template_name = 'index.html'

    def get(self, request, *args, **kwargs):
        p = Photos.objects.filter(published='public').order_by('?').first()
        context = {
            'photo': p
        }
        return render(request, self.template_name, context=context)

@@ -184,29 +184,26 @@
  get
-(self, request, *args
+_context_data(self
 , **
@@ -309,107 +309,106 @@
 t = 
-%7B%0A            'photo': p%0A        %7D%0A        return render(request, self.template_name, context=context)
+super(IndexView, self).get_context_data(**kwargs)%0A        context%5B'photo'%5D = p%0A        return context
 %0A

change get() to get_context_data()