Exemplo n.º 1
0
def user_register(request):
    if request.user.is_anonymous():
        if request.method == 'POST':
            form = UserRegistrationForm(request.POST)
            if form.is_valid():
                userAccount = form.save()
                user = authenticate(username=form.cleaned_data['username'], password=form.cleaned_data['password1'])
                if user is not None:
                    login(request, user)
                #send confirmation email
                sendMail(profileUtil.getProfileFromUser(userAccount), \
                    "Welcome aboard! ", "Thank you for registering with ToolCloud.")
                shedName = form.cleaned_data['username'] + "'s Shed"
                userProfile = profileUtil.getProfileFromUser(userAccount)
                newShedObject = Shed(name=shedName, owner=userProfile, location='location', sharezone=form.cleaned_data['zip_code'],\
                    status='status')
                newShedObject.save()
                newShedObject.members.add(userProfile)
                newShedObject.admins.add(userProfile)
                newShedObject.save()
                userProfile.personalShed = newShedObject
                context = {}
                context.update(content.genUserHome(request))
                context.update(content.addGoodRegisterNoti(dict()))
                return render_to_response('userHome.html', context)
        else:
            form = UserRegistrationForm()
        context = {}
        context.update(csrf(request))
        context['form'] = form
        context.update(content.genSuper())
        #Pass the context to a template
        return render_to_response('register.html', context)
    else:
        return HttpResponseRedirect('/')
Exemplo n.º 2
0
def user_register(request):
    if request.user.is_anonymous():
        if request.method == 'POST':
            form = UserRegistrationForm(request.POST)
            if form.is_valid():
                userAccount = form.save()
                user = authenticate(username=form.cleaned_data['username'],
                                    password=form.cleaned_data['password1'])
                if user is not None:
                    login(request, user)
                #send confirmation email
                sendMail(profileUtil.getProfileFromUser(userAccount), \
                    "Welcome aboard! ", "Thank you for registering with ToolCloud.")
                shedName = form.cleaned_data['username'] + "'s Shed"
                userProfile = profileUtil.getProfileFromUser(userAccount)
                newShedObject = Shed(name=shedName, owner=userProfile, location='location', sharezone=form.cleaned_data['zip_code'],\
                    status='status')
                newShedObject.save()
                newShedObject.members.add(userProfile)
                newShedObject.admins.add(userProfile)
                newShedObject.save()
                userProfile.personalShed = newShedObject
                context = {}
                context.update(content.genUserHome(request))
                context.update(content.addGoodRegisterNoti(dict()))
                return render_to_response('userHome.html', context)
        else:
            form = UserRegistrationForm()
        context = {}
        context.update(csrf(request))
        context['form'] = form
        context.update(content.genSuper())
        #Pass the context to a template
        return render_to_response('register.html', context)
    else:
        return HttpResponseRedirect('/')
Exemplo n.º 3
0
    if userName == "AlArujunan":
        newProfile.emailNotifs == False
        newProfile.textNotifs == False
    newProfile.save()
    profileObjects.append(newProfile)


shedNames = ["AlArujunan's Shed", "JakeDulin's Shed", "RoyCohen's Shed", "AlexBowen's Shed", "TaikhoomAttar's Shed", \
    "JacksonMcMahon's Shed", "AdamWalsh's Shed"]

shedObjects = []

for x in range(len(shedNames)):

    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']
Exemplo n.º 4
0
	if userName == "AlArujunan":
		newProfile.emailNotifs == False
		newProfile.textNotifs == False
	newProfile.save()
	profileObjects.append(newProfile)

	
shedNames = ["AlArujunan's Shed", "JakeDulin's Shed", "RoyCohen's Shed", "AlexBowen's Shed", "TaikhoomAttar's Shed", \
				"JacksonMcMahon's Shed", "AdamWalsh's Shed"]

shedObjects = []

for x in range(len(shedNames)):

	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']
Exemplo n.º 5
0
def createNewShed(ownerProfileObj, name, location, sharezone, status):
    newShed = Shed(name=name,owner=ownerProfileObj,location=location, \
        sharezone=sharezone,status=status)
    newShed.save()
    return newShed
Exemplo n.º 6
0
def createNewShed(ownerProfileObj,name,location,sharezone,status):
	newShed = Shed(name=name,owner=ownerProfileObj,location=location, \
					sharezone=sharezone,status=status)
	newShed.save()
	return newShed