Created
September 20, 2012 04:12
-
-
Save markshust/3753945 to your computer and use it in GitHub Desktop.
obj_get_list example with filtering
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
def obj_get_list(self, request=None, **kwargs): | |
if 'area' in request.GET and request.GET['area'] and 'item' in request.GET and request.GET['item']: | |
area_val = request.GET['area'] | |
item_val = request.GET['item'] | |
queryset = ItemToArea.objects.filter(area=area_val,item=item_val) | |
return queryset | |
if 'area' in request.GET and request.GET['area']: | |
area_val = request.GET['area'] | |
queryset = ItemToArea.objects.filter(area=area_val) | |
return queryset | |
else: | |
return [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment