Пример #1
0
	def view( self, request, shop_name ):
		""" Try to apply back offset view to create more convenient service """
		page = int( request.REQUEST[ 'page' ] ) if 'page' in request.REQUEST else 1	
	
		product_page = ItemPage( Product )
		page_products = product_page.get( q_dict = { 'shop': get_shop_by_name( request.session, shop_name ) }, page = page )

		return super( EditProductsView, self ).view( request, { 'page_products': page_products, 'page': page, 'shop_name': shop_name } )
Пример #2
0
	def view( self, request ):
		req = request.REQUEST
		page = int( req[ 'page' ] ) if 'page' in req else 1
		
		shop_page = ItemPage( Shop )
		page_shops = shop_page.get( q_dict = { 'is_removed': False }, page = page )

		return super( ListView, self ).view( request, { 'page_shops': page_shops, 'page': page } )
Пример #3
0
	def view( self, request ):
		
		queryDict = request.REQUEST
		
		page = int( queryDict[ 'page' ] )
		num_products_on_page = queryDict[ 'num_products_on_page' ]
		product_page = ItemPage( Product )

		if 'category-id' in queryDict and int( queryDict[ 'category-id' ] ) != ProductPage.NO_CATEGORY:
			category = ProductCategory.objects.get( id = int( queryDict[ 'category-id' ] ) )
			page_products = product_page.get( category = category, page = page )
			category_id = int( queryDict[ 'category-id' ] )
		else:
			page_products = product_page.get( category = ProductPage.NO_CATEGORY, page = page )
			category_id = ProductPage.NO_CATEGORY
		
		return super( ProductListView, self ).view( request, { 'page_products': page_products, 'page': page, 'category_id': category_id }, 'application/json' )
Пример #4
0
def _shops_list_view( inst, parent, request, d, user ):
	"""
	To display a list of shops by several conditions
	"""
	q_dict = d[ 'q_dict' ]
	req = request.REQUEST
	page = int( req[ 'page' ] ) if 'page' in req else 1		
	shop_page = ItemPage( Shop )
	page_shops = shop_page.get( q_dict = q_dict, page = page )
	del d[ 'q_dict' ]
	d.update( { 'page_shops': page_shops, 'page': page, 'user2': user } )
	return parent.view( request, d )