Created
May 22, 2015 19:47
-
-
Save svfat/2300c7420776289ecad5 to your computer and use it in GitHub Desktop.
Django - Get queryset from filtered objects with parameters from request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.views.generic import ListView | |
from sampleapp.models import Sample | |
class CustomListView(ListView): | |
def get_queryset(self): | |
query_dict = self.request.GET | |
return Sample.objects.filter(**query_dict.dict()) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment