Skip to content

Instantly share code, notes, and snippets.

@spookylukey
Created May 4, 2012 17:09
Show Gist options
  • Save spookylukey/2596285 to your computer and use it in GitHub Desktop.
Save spookylukey/2596285 to your computer and use it in GitHub Desktop.
# list_detail.object_list replacement with all the things I need
def object_list(request, queryset, extra_context=None,
template_name='', paginate_by=None):
class ObjectList(ListView):
def post(self, request, *args, **kwargs):
return self.get(request, *args, **kwargs)
def get_context_data(self, **kwargs):
c = super(ObjectList, self).get_context_data(**kwargs)
c.update(extra_context)
return c
return ObjectList.as_view(template_name=template_name,
paginate_by=paginate_by,
queryset=queryset)(request)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment