Python django.views.generic.list.ListView() Examples

The following are 4 code examples of django.views.generic.list.ListView(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module django.views.generic.list , or try the search function .
Example #1
Source File: views.py    From connect with MIT License 6 votes vote down vote up
def get_context_data(self, **kwargs):
        """Add necessary information to the context"""
        context = super(InboxView, self).get_context_data(**kwargs)

        #serialized_threads = None

        # We're provided a paginator as part of our ListView parent and as
        # part of generating that paginator a `.count()` is run against our
        # queryset. This is a quick way to get our count without another query
        # even if we don't need the paginator
        thread_count = context['paginator'].count

        # Generate the context variable to be passed to the backbone models
        js_context = self.get_js_context_data()
        js_context['total_threads'] = thread_count
        context['js_context'] = json.dumps(js_context)
        return context 
Example #2
Source File: CRUD.py    From djreservation with GNU General Public License v3.0 5 votes vote down vote up
def get_list_view_class(self):
        class UListView(ListView):

            def get_queryset(self):
                queryset = super(UListView, self).get_queryset()
                queryset = queryset.filter(user=self.request.user)
                return queryset
        return UListView 
Example #3
Source File: views.py    From djanblog with MIT License 5 votes vote down vote up
def get_context_data(self, **kwargs):
        context = super(ListView, self).get_context_data(**kwargs)
        title = ''
        context['title'] = title
        return context 
Example #4
Source File: views.py    From djanblog with MIT License 5 votes vote down vote up
def get_context_data(self, **kwargs):
        context = super(ListView, self).get_context_data(**kwargs)
        title = self.kwargs.get('slug')
        context['tag'] = Tag.objects.get(name=title)
        context['title'] = title
        return context