def obj_get_list(self, request=None, **kwargs): form = Featured(request.GET, region=getattr(request, 'REGION', regions.WORLDWIDE).slug) if not form.is_valid(): raise self.form_errors(form) return Webapp.featured(**form.as_featured())
def get_list(self, request, **kwargs): form = Featured(request.GET, region=getattr(request, 'REGION', regions.WORLDWIDE).slug) if not form.is_valid(): raise self.form_errors(form) data = form.as_featured() # By default the home page has no category. data['cat'] = None # Regardless of the limit, we will override that. data['limit'] = 9 if data['mobile'] else 12 cat = CategoryResource() featured = Webapp.featured(**data) return self.create_response(request, { 'categories': cat.dehydrate_objects(cat.obj_get_list()), 'featured': AppResource().dehydrate_objects(featured) })
def get_list(self, request, **kwargs): form = Featured(request.GET, region=getattr(request, 'REGION', regions.WORLDWIDE).slug) if not form.is_valid(): raise self.form_errors(form) data = form.as_featured() # By default the home page has no category. data['cat'] = None # Regardless of the limit, we will override that. data['limit'] = 9 if data['mobile'] else 12 cat = CategoryResource() featured = Webapp.featured(**data) return self.create_response( request, { 'categories': cat.dehydrate_objects(cat.obj_get_list()), 'featured': AppResource().dehydrate_objects(featured) })
def lookup(self, region, device): form = Featured({'dev': device}, region=region) ok_(form.is_valid(), form.errors) return form.as_featured()