Skip to main content

split Django ListView queryset

Project description


$ [sudo] pip install django-split-listview


from django_split_listview.views import SplitListView

class RepoListView(SplitListView):
    def get_queryset_base(self):
        return self.model.all()

    def get_queryset_filter_kwargs(self):
        if self.request.GET.get('type','') == 'fork':
            return {'fork':True}

    def get_queryset_only_fields(self):
        return ['id','name','stargazers_count','language']

    def get_queryset_order_by_fields(self):
        if self.request.GET.get('o','') == 'stars':
            return ['-stargazers_count']
        return ['-updated_at']


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-split-listview-2020.4.25.tar.gz (2.0 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page