def create(request): params = {} form = ItemEditForm( initial={ 'name': '', 'description': '', 'price': '', 'owner': '', 'cost': '', 'quantityOnHand': '', 'forSale': '', }) if request.method == 'POST': form = ItemEditForm(request.POST) if form.is_valid(): itemSpec = hmod.ItemSpecifications() itemSpec.name = form.cleaned_data['name'] itemSpec.description = form.cleaned_data['description'] itemSpec.user_id = form.cleaned_data['owner'] itemSpec.price = form.cleaned_data['price'] item = hmod.Item() item.itemSpecifications = itemSpec item.cost = form.cleaned_data['cost'] item.quantityOnHand = form.cleaned_data['quantityOnHand'] item.forSale = form.cleaned_data['forSale'] item.save() return HttpResponseRedirect('/homepage/items/') params['form'] = form return templater.render_to_response(request, 'items_edit.html', params)
def create(request): item = hmod.Item() item.name = "" item.value = '0.0' item.standard_rental_price = '0.00' item.legal_entity_id = hmod.LegalEntity.objects.first().id item.save() return HttpResponseRedirect('/homepage/item.edit/{}/'.format(item.id))
def create(request): params = {} item = hmod.Item() item.name = '' item.description = '' item.value = '0.0' item.save() return HttpResponseRedirect('/administration/items.edit/{}/'.format(item.id))
def create(request): # params = {} item = hmod.Item() item.name = '' item.description = '' item.value = None item.standard_rental_price = None item.save() return HttpResponseRedirect('/inventory/item.edit/{}'.format(item.id))
def create(request): '''Creates a new item''' item = hmod.Item() item.name = 'name' item.description = 'description' item.value = 00.00 item.standard_rental_price = 00.00 item.legal_entity_id = hmod.LegalEntity.objects.first().id item.save() return HttpResponseRedirect('/homepage/item.edit/{}/'.format(item.id))
def create(request): item = hmod.Item() item.name = '' item.description = '' item.value = '0.00' item.standardRentalPrice = '0.00' #item.Users_id = '' item.save() return HttpResponseRedirect('/homepage/items.edit/{}'.format(item.id))
def create(request): item1 = hmod.Item() item1.name = 'NewItem' item1.description = '' item1.value = 0.00 item1.standard_rental_price = 0.00 # ... other field defaults item1.save() return HttpResponseRedirect('/homepage/items.edit/{}/'.format( item1.photographablething_ptr_id))
def create(request): item = hmod.Item() item.name = 'name' item.description = 'this is a description of the item' item.value = '59.99' item.standard_rental_price = '17.99' item.save() return HttpResponseRedirect('/homepage/items.edit/{}/'.format( item.object_id))
def create(request): ''' create: Creates empty item, sends user to edit page ''' params = {} # create item object item = hmod.Item() # save new item item.save() # send user to edit page return HttpResponseRedirect('/manager/items.edit/{}/'.format(item.id))
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') item = hmod.Item() item.name = '' item.description = '' item.value = 0 item.standard_rental_price = 0 # item.owner = hmod.User.objects.get(id=1) item.save() return HttpResponseRedirect('/homepage/items.edit/{}'.format(item.id))
{ 'name': 'Bonnet', 'description': 'Clothing', 'current_price': '4.99', 'photo': 'product10.jpg' }, { 'name': 'Coins', 'description': 'Collectibles', 'current_price': '67.88', 'photo': 'product11.jpg' }, { 'name': 'Spectacles', 'description': 'Clothing', 'current_price': '28.73', 'photo': 'product12.jpg' }, { 'name': 'Sword', 'description': 'Weapons', 'current_price': '87.56', 'photo': 'product13.jpg' }, ]: d = hmod.Item() for k, v in data.items(): setattr(d, k, v) d.save()
[ 'Rifle', 'Colonial Hunting Rifle', 1000.00, 35, True, hmod.User.objects.get(id=1), hmod.Photograph.objects.get(id=1) ], [ 'Bicycle', 'Colonial bike', 1000.00, 35, True, hmod.User.objects.get(id=1), hmod.Photograph.objects.get(id=1) ], [ 'Whip', 'Colonial whip', 10.00, 3, True, hmod.User.objects.get(id=1), hmod.Photograph.objects.get(id=1) ]]: item = hmod.Item() item.name = data[0] item.description = data[1] item.value = data[2] item.standard_rental_price = data[3] item.is_rentable = data[4] item.user = data[5] item.photo = data[6] item.save() #Create Wardobe_Item for data in [[ 'Dolly Madison Dress', 'Dress for actress role Dolly Madison', 50.99, 15.99, False, hmod.User.objects.get(id=1), hmod.Photograph.objects.get(id=1), 'M', '33" waist', 'Female', 'Red',
photo.save() p1 = hmod.Product() p1.name = "Declaration of Independence" p1.description = "Replica of the Declaration of Independence" p1.category = "Mass Produced" p1.current_price = 3.99 p1.save() photo = hmod.Photograph() photo.object_pictured = p1 photo.image = "http://www.loc.gov/rr/program/bib/ourdocs/Images/declaration.jpg" photo.save() ## Items: i1 = hmod.Item() i1.name = "Musket" i1.description = "A colonial era musket. Uses gun powder." i1.value = 135 i1.standard_rental_price = 18.75 i1.save() i2 = hmod.Item() i2.name = "Waistcoat" i2.description = "A replica of George Washington's waistcoat as he crossed the Delaware." i2.value = 35 i2.standard_rental_price = 4.95 i2.save() ## Organizations: org1 = hmod.Organization()