示例#1
0
def create(request):
    product = hmod.Product()
    product.name = ""
    product.description = ""
    product.category = ""
    product.current_price = '0.0'
    product.save()

    return HttpResponseRedirect('/homepage/product.edit/{}/'.format(
        product.id))
示例#2
0
文件: products.py 项目: arkon24/CHF
def create(request):
    product = hmod.Product()
    product.name = ''
    product.description = ''
    product.price = '0.00'

    product.save()

    return HttpResponseRedirect('/homepage/products.edit/{}'.format(
        product.id))
示例#3
0
def create(request):
    product1 = hmod.Product()
    product1.name = 'NewProduct'
    product1.description = ''
    product1.category = ''
    product1.current_price = 0.00
    # ... other field defaults
    product1.save()

    return HttpResponseRedirect('/homepage/products.edit/{}/'.format(
        product1.photographablething_ptr_id))
示例#4
0
文件: products.py 项目: rodcox89/chf
def create(request):
    params = {}

    product = hmod.Product()
    product.name = ''
    product.description = ''
    product.value = '0.0'
    product.save()

    return HttpResponseRedirect('/administration/products.edit/{}/'.format(
        product.id))
示例#5
0
def create(request):
    # params = {}

    product = hmod.Product()
    product.name = ''
    product.description = ''
    product.category = ''
    product.current_price = None
    product.save()

    return HttpResponseRedirect('/inventory/product.edit/{}'.format(
        product.id))
示例#6
0
文件: products.py 项目: Romney81/CHF
def create(request):
    params = {}

    product = hmod.Product()
    product.name = ''
    product.category = ''
    product.current_price = '0.0'

    product.save()

    return HttpResponseRedirect('/administrator/products.edit/{}/'.format(
        product.id))
示例#7
0
def create(request):

    product = hmod.Product()
    product.name = 'name'
    product.description = 'this is a description of the product'
    product.category = 'category'
    product.current_price = '17.99'

    product.save()

    return HttpResponseRedirect('/homepage/products.edit/{}/'.format(
        product.object_id))
示例#8
0
def create(request):
    if not request.user.is_authenticated():
        return redirect('/homepage/login/?next=%s' % request.path)
    if not request.user.is_staff:
        return HttpResponseRedirect('/homepage/authentication')
    '''Creates a new product'''
    product = hmod.Product()
    product.category = ''
    # product.current_price = ''
    product.producer_name = ''
    product.save()

    return HttpResponseRedirect('/homepage/products.edit/{}/'.format(
        product.id))
示例#9
0
文件: products.py 项目: danmo91/INTEX
def create(request):
    '''
        create: Creates empty product, sends user to edit page
    '''
    params = {}

    # create product object
    product = hmod.Product()

    # save new product
    product.save()

    # send user to edit page
    return HttpResponseRedirect('/manager/products.edit/{}/'.format(
        product.id))
示例#10
0
def create(request):

    if not request.user.is_authenticated():
        return redirect('/homepage/login/?next=%s' % request.path)
    if not request.user.is_staff:
        return HttpResponseRedirect('/homepage/authentication')
    product = hmod.Product()
    '''
    name = models.TextField(max_length=20)
    description = models.TextField(max_length=50)
    category = models.TextField(max_length=15)
    current_price = models.FloatField()
    owner = models.ForeignKey('User') # this used to reference Legal_Entity
    '''
    product.name = ''
    product.description = ''
    product.category = 'antiques'
    product.current_price = 10
    product.owner = hmod.User.objects.get(id=1)
    product.save()

    return HttpResponseRedirect('/homepage/products.edit/{}/'.format(
        product.id))
示例#11
0
    },
    {
        'name': 'Sword',
        'category': 'Weapons',
        'current_price': '234.84',
        'product_type': 'Mass Produced',
        'producer_name': 'Colonial Heritage Foundation',
        'quantity_on_hand': '400',
        'date_made': '2015-03-06',
        'order_form_name': 'Pittsburgh',
        'production_time': '2015-03-06',
        'photo': 'product13.jpg'
    },
]:

    d = hmod.Product()
    for k, v in data.items():
        setattr(d, k, v)
    d.save()

# populating data for item
for data in [
    {
        'amount_due': '43.42',
        'name': 'Rental Item 1',
        'description': 'Description 1',
        'item_value': '5.00',
        'standard_rental_price': '3.00',
        'is_rentable': 'TRUE',
        'owner_id': '1'
    },
示例#12
0
user3.last_name = "Kirk"
user3.username = "******"
user3.email = "*****@*****.**"
user3.set_password('kirk789')
user3.save()

user4 = hmod.User()
user4.first_name = "Anakin"
user4.last_name = "Skywalker"
user4.username = "******"
user4.email = "*****@*****.**"
user4.set_password('padme')
user4.save()

## Products and Photographs:
p1 = hmod.Product()
p1.name = "Minted Coin"
p1.description = "Metal coin replica of olonial money. Has Colonial Heritage Foundation logo on it."
p1.category = "Mass Produced"
p1.current_price = 3.99
p1.save()

photo = hmod.Photograph()
photo.object_pictured = p1
photo.image = "https://www.regalassets.com/images/indian-head-coins-F.jpg"
photo.save()

p1 = hmod.Product()
p1.name = "Photo of George Washington"
p1.description = "One of our founding fathers."
p1.category = "Mass Produced"
示例#13
0
文件: init_db.py 项目: arkon24/CHF
s = hmod.Session()
s.expire_date = '2015-02-21'
s.session_date = datetime.datetime.now()
s.user = hmod.Users.objects.get(username='******')
s.save()

sc = hmod.Shopping_Cart()
sc.session = hmod.Session.objects.get(expire_date='2015-02-20')
sc.save()

sc = hmod.Shopping_Cart()
sc.session = hmod.Session.objects.get(expire_date='2015-02-21')
sc.save()

p = hmod.Product()
p.name = 'Colonial Hat'
p.price = '20.99'
p.description = 'A tricorn hat used in the late 1700s'
p.manufacturer = 'Hatco'
p.average_cost = '15.99'
p.sku = '1110'
p.order_form_name = ''
p.production_time = ''
p.category = ''
p.save()

p = hmod.Product()
p.name = 'Miniature Liberty Bells'
p.price = '8.99'
p.description = 'Small Replica Liberty Bells'
示例#14
0
        'Lorem ipsum dolor sit amet, consectetur adipisicing elit',
        "Battle Gear", 5.00
    ],
    [
        'Pocket watch',
        'Lorem ipsum dolor sit amet, consectetur adipisicing elit',
        "Accessories", 45.00
    ],
    [
        'Replica telescope',
        'Lorem ipsum dolor sit amet, consectetur adipisicing elit',
        "Collector's Item", 175.00
    ],
    [
        'Teacup set',
        'Lorem ipsum dolor sit amet, consectetur adipisicing elit', "Filigree",
        25.00
    ],
]:
    product = hmod.Product()

    product.name = data[0]
    product.description = data[1]
    product.category = data[2]
    product.current_price = data[3]
    # product.owner = hmod.User.objects.get(id=1)
    product.save()

# run the server automatically
# subprocess.call([sys.executable, "manage.py", "runserver"])