Skip to content

Instantly share code, notes, and snippets.

@jmg
Created December 12, 2012 21:26
Show Gist options
  • Save jmg/4271779 to your computer and use it in GitHub Desktop.
Save jmg/4271779 to your computer and use it in GitHub Desktop.
Django class based view
from django.views.generic import TemplateView
class MyView(TemplateView):
url = "myurl/view1"
template_name = "index/template.html"
def get(self, *args, **kwargs):
context = {}
context["projects"] = Project.objects.all()
return self.render_to_response(context)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment