Beispiel #1
0
def createNewTool(name, description, ownerObj, location, picture, isAvailable, \
					preferences, tags):
	toolObject = Tool()
	toolObject.name = name
	toolObject.description = description
	toolObject.tags = tags
	toolObject.owner = ownerObj
	toolObject.location = location
	toolObject.isAvailable = isAvailable
	toolObject.preferences = preferences
	toolObject.save()
	return toolObject
Beispiel #2
0
def createNewTool(name, description, ownerObj, location, picture, isAvailable, \
     preferences, tags):
    toolObject = Tool()
    toolObject.name = name
    toolObject.description = description
    toolObject.tags = tags
    toolObject.owner = ownerObj
    toolObject.location = location
    toolObject.isAvailable = isAvailable
    toolObject.preferences = preferences
    toolObject.save()
    return toolObject
    newShed = Shed(name=shedNames[x], owner=profileObjects[x], location=profileObjects[x].streetAddress + \
     ", " + profileObjects[x].city + ", " + profileObjects[x].state + " " + profileObjects[x].sharezone, \
        sharezone=profileObjects[x].sharezone, status='status')
    newShed.save()
    newShed.members.add(profileObjects[x])
    newShed.admins.add(profileObjects[x])
    newShed.save()
    profileObjects[x].personalShed = newShed
    profileObjects[x].save()
    shedObjects.append(newShed)


toolNames = ['Claw Hammer','Wrench','Screwdriver','Hoe','Drill','Impact Wrench', \
       'Shovel', 'Hand Saw', 'Electric Screwdriver', 'Nail Gun', '3D Printer', 'Heat Gun', \
       'Circular Saw', 'Nibbler', 'Belt Sander', 'Chainsaw', 'Hedge clippers', 'Pressure Washer',
       'Wet Vacuum', 'Shamwow', 'Tile Saw', 'Socket Wrench', 'Sledgehammer', 'Reciprocating Saw']

toolObjects = []

for x in range(len(toolNames)):

    newTool = Tool(name = toolNames[x], description='description', \
        isAvailable = True, tags = 'tags')
    newTool.owner = profileObjects[x % len(profileObjects)]
    newTool.myShed = shedObjects[x % len(shedObjects)]
    newTool.location = newTool.myShed.location
    newTool.save()
    toolObjects.append(newTool)

#print("--> Database populated")
	newShed = Shed(name=shedNames[x], owner=profileObjects[x], location=profileObjects[x].streetAddress + \
		", " + profileObjects[x].city + ", " + profileObjects[x].state + " " + profileObjects[x].sharezone, \
					sharezone=profileObjects[x].sharezone, status='status')
	newShed.save()
	newShed.members.add(profileObjects[x])
	newShed.admins.add(profileObjects[x])
	newShed.save()
	profileObjects[x].personalShed = newShed
	profileObjects[x].save()
	shedObjects.append(newShed)


toolNames = ['Claw Hammer','Wrench','Screwdriver','Hoe','Drill','Impact Wrench', \
		     'Shovel', 'Hand Saw', 'Electric Screwdriver', 'Nail Gun', '3D Printer', 'Heat Gun', \
		     'Circular Saw', 'Nibbler', 'Belt Sander', 'Chainsaw', 'Hedge clippers', 'Pressure Washer',
		     'Wet Vacuum', 'Shamwow', 'Tile Saw', 'Socket Wrench', 'Sledgehammer', 'Reciprocating Saw']

toolObjects = []

for x in range(len(toolNames)):

	newTool = Tool(name = toolNames[x], description='description', \
					isAvailable = True, tags = 'tags')
	newTool.owner = profileObjects[x % len(profileObjects)]
	newTool.myShed = shedObjects[x % len(shedObjects)]
	newTool.location = newTool.myShed.location
	newTool.save()
	toolObjects.append(newTool)

#print("--> Database populated")