Exemple #1
0
def deploy(request):
  key = request.GET['key']
  order = SupplierOrder.get_by_id(int(key))
  if not order:
    return retailError(request,"Order not exist.")
  orderitems = SupplierItem.all().ancestor(order)
  supplier = getSupplierByName(order.supplier)
  if not supplier:
    supdata = {'store':order.supplier,
        'category':{'other':{'name':'misc','children':{}}}}
    supplier = Supplier(name = order.supplier,data=json.dumps(supdata['category']))
    supplier.put()
  for item in orderitems:
    deployitem(item,supplier)
  return HttpResponseRedirect('/admin/items/'+supplier.name+"/other/")
Exemple #2
0
def items(request, shop, category):
    supplier = getSupplier(shop)
    suppliers = Supplier.all()
    stories = {}
    lvl1 = "Category"
    lvl2 = "Gallery"
    for supply in suppliers:
        stories[supply.name] = json.loads(supply.data)
        if (supply.name == shop):
            for c in stories[supply.name]:
                if (category in stories[supply.name][c]['children']):
                    lvl1 = stories[supply.name][c]['name']
                    lvl2 = stories[
                        supply.name][c]['children'][category]['name']
    dict = {
        'SHOP': shop,
        'ITEM_WIDTH': '200',
        'STORIES': stories,
        'PATH': lvl1,
        'CATEGORY': lvl2
    }
    if (supplier):
        dict['sellitems'] = pageItems(
            supplier.getCategoryItems(category), dict,
            "/admin/items/" + shop + "/" + category + "/", request)
        context = Context(dict)
        return (render_to_response("./admin/items.html",
                                   context,
                                   context_instance=RequestContext(request)))
    else:
        dict['sellitems'] = []
        context = Context(dict)
        return (render_to_response("./admin/items.html",
                                   context,
                                   context_instance=RequestContext(request)))
Exemple #3
0
def admin(request):
  suppliers = Supplier.all()
  stories = {}
  stat = {}
  estat = {}
  items = []
  for supply in suppliers:
    stories[supply.name] = json.loads(supply.data)
    stat[supply.name] = supply.getStat()
    estat[supply.name] = supply.getEbayStat()
  context = Context({'sellitems':items
   ,'STORIES':stories,'STAT':stat,'ESTAT':estat})
  return (render_to_response("admin/dashboard.html",context,context_instance=RequestContext(request)))
Exemple #4
0
def deploy(request):
    key = request.GET['key']
    order = SupplierOrder.get_by_id(int(key))
    if not order:
        return retailError(request, "Order not exist.")
    orderitems = SupplierItem.all().ancestor(order)
    supplier = getSupplierByName(order.supplier)
    if not supplier:
        supdata = {
            'store': order.supplier,
            'category': {
                'other': {
                    'name': 'misc',
                    'children': {}
                }
            }
        }
        supplier = Supplier(name=order.supplier,
                            data=json.dumps(supdata['category']))
        supplier.put()
    for item in orderitems:
        deployitem(item, supplier)
    return HttpResponseRedirect('/admin/items/' + supplier.name + "/other/")
Exemple #5
0
def itemimage(request,shop,key):
  suppliers = Supplier.all()
  stories = {}
  items = []
  for supply in suppliers:
    stories[supply.name] = json.loads(supply.data)
  item = Item.get_by_id(int(key),parent = getSupplier(shop))
  if(item):
    upload_url = '/admin/blobimage/'+ shop + "/" + key +"/0/"
    upload_url1 = '/admin/blobimage/'+ shop + "/" + key +"/1/"
    upload_url2 = '/admin/blobimage/'+ shop + "/" + key +"/2/"
    upload_url3 = '/admin/blobimage/'+ shop + "/" + key +"/3/"
    dict = {'ITEM':item,'STORIES':stories,'BLOBURL':upload_url
        ,'BLOBURL1':upload_url1
        ,'BLOBURL2':upload_url2
        ,'BLOBURL3':upload_url3}
    context = Context(dict)
    return (render_to_response("admin/image.html",context,context_instance=RequestContext(request)))
Exemple #6
0
def admin(request):
    suppliers = Supplier.all()
    stories = {}
    stat = {}
    estat = {}
    items = []
    for supply in suppliers:
        stories[supply.name] = json.loads(supply.data)
        stat[supply.name] = supply.getStat()
        estat[supply.name] = supply.getEbayStat()
    context = Context({
        'sellitems': items,
        'STORIES': stories,
        'STAT': stat,
        'ESTAT': estat
    })
    return (render_to_response("admin/dashboard.html",
                               context,
                               context_instance=RequestContext(request)))
Exemple #7
0
def items(request,shop,category):
  supplier = getSupplier(shop)
  suppliers = Supplier.all()
  stories = {}
  lvl1 = "Category"
  lvl2 = "Gallery"
  for supply in suppliers:
    stories[supply.name] = json.loads(supply.data)
    if (supply.name == shop):
      for c in stories[supply.name]:
        if (category in stories[supply.name][c]['children']):
          lvl1 = stories[supply.name][c]['name']
          lvl2 = stories[supply.name][c]['children'][category]['name']
  dict = {'SHOP':shop,'ITEM_WIDTH':'200','STORIES':stories,'PATH':lvl1,'CATEGORY':lvl2}
  if (supplier):
    dict['sellitems'] = pageItems(supplier.getCategoryItems(category),
        dict,"/admin/items/"+shop+"/" + category + "/",request)
    context = Context(dict)
    return (render_to_response("./admin/items.html",context,context_instance=RequestContext(request)))
  else:
    dict['sellitems'] = []
    context = Context(dict)
    return (render_to_response("./admin/items.html",context,context_instance=RequestContext(request)))
Exemple #8
0
def itemimage(request, shop, key):
    suppliers = Supplier.all()
    stories = {}
    items = []
    for supply in suppliers:
        stories[supply.name] = json.loads(supply.data)
    item = Item.get_by_id(int(key), parent=getSupplier(shop))
    if (item):
        upload_url = '/admin/blobimage/' + shop + "/" + key + "/0/"
        upload_url1 = '/admin/blobimage/' + shop + "/" + key + "/1/"
        upload_url2 = '/admin/blobimage/' + shop + "/" + key + "/2/"
        upload_url3 = '/admin/blobimage/' + shop + "/" + key + "/3/"
        dict = {
            'ITEM': item,
            'STORIES': stories,
            'BLOBURL': upload_url,
            'BLOBURL1': upload_url1,
            'BLOBURL2': upload_url2,
            'BLOBURL3': upload_url3
        }
        context = Context(dict)
        return (render_to_response("admin/image.html",
                                   context,
                                   context_instance=RequestContext(request)))