Refactoring to common queryset across ajax and views