Beispiel #1
0
def add_category():
    category = Category()
    category.id = randint(0, 999999)
    category.name = request.form['name']
    CategorySerializer().add_category(category)

    return render_template("admin.html")
Beispiel #2
0
 def post(self):
     parser = parse_factory.getCategoryParser()
     args = parser.parse_args()
     new_cat = Category()
     new_cat.category_id = args['category_id']
     new_cat.name = args['name']
     new_cat.last_update = args['last_update']
     print(new_cat)
     handler.addCategory(new_cat)
Beispiel #3
0
 def get_category(self, id, name=None):
     """
     Returns a Category for the passed ID, associated with this API object.
     """
     id = int(id)
     if id in self.cached_categories.keys():
         cat = self.cached_categories[id]
     else:
         cat = Category(id, self)
     if name:
         cat.name = name
     return cat
Beispiel #4
0
 def get_category(self, id, name=None):
     """
     Returns a Category for the passed ID, associated with this API object.
     """
     id = int(id)
     if id in self.cached_categories.keys():
         cat = self.cached_categories[id]
     else:
         cat = Category(id, self)
     if name:
         cat.name = name
     return cat
Beispiel #5
0
brand.name = "giani"

print "save : {}".format(brand.Save())
print "list : {}".format(brand.GetAllBrands())

print "\n\n"

####################################
########### category.py ############
####################################

print "testing category"

category = Category()
category.parent = ""
category.name = "zapatos"

print "save : {}".format(category.Save())
print "list : {}".format(category.GetAllCategories())

print "\n\n"

####################################
########### product.py #############
####################################

product = Product()

product.name = "nuevo producto"
product.description = "a product description"
product.sku = "123"
Beispiel #6
0
            ,image_6 = %(image_6)s 
            ,category_id = %(category_id)s 
            ,price = %(price)s 
            ,upc = %(upc)s
            ,color = %(color)s
            ,sell_price = %(sell_price)s
            ,which_size = %(which_size)s
            ,promotion_price = %(promotion_price)s
            ,bulk_price = %(bulk_price)s
            ,position = %(position)s
            ,sold = %(sold)s
            ,added = %(added)s
            ,delivery = %(delivery)s where sku = %(sku)s and deleted = %(deleted)s returning id'''

            category = Category()
            category.name = self.category
            res = category.Save()

            if "error" in res:
                return self.ShowError("Category can not be saved {}".format(res["error"]))

            p = {
                "name": self.name,
                "description": self.description,
                "brand": self.brand,
                "manufacturer": self.manufacturer,
                "color": self.color,
                "material": self.material,
                "bullet_1": self.bullet_1,
                "bullet_2": self.bullet_2,
                "bullet_3": self.bullet_3,