コード例 #1
0
ファイル: views.py プロジェクト: roycohen2013/TheSquad
def view_current_profile(request, contextArg):
    """this view displays account information and allows users to edit their information
    """
    if request.user.is_anonymous():
        #tell user they need to be logged in to do that
        return HttpResponseRedirect('/accounts/login/') #redirect to login page
    else:
        currentUser = request.user
        userProfile = profileUtil.getProfileFromUser(currentUser)
        print(userProfile.personalShed)
        reputation = profileUtil.getReputation(userProfile)
        timeCreated = userProfile.timeCreated
        streetAddress = profileUtil.getAddress(userProfile)
        city = profileUtil.getCity(userProfile)
        state = profileUtil.getStateName(userProfile)
        shareZone = profileUtil.getSharezone(userProfile)
        context = {}
        context.update(csrf(request))
        context['userProfile'] = userProfile
        context['timeStamp'] = timeCreated
        context['streetAddress'] = streetAddress
        context['reputation'] = reputation
        context['city'] = city
        context['state'] = state
        context['sharezone'] = shareZone
        context.update(content.genBaseLoggedIn(request))
        if contextArg:
            context.update(contextArg)
        return render_to_response('my_account.html', context)
コード例 #2
0
ファイル: views.py プロジェクト: roycohen2013/TheSquad
def view_current_profile(request, contextArg):
    """this view displays account information and allows users to edit their information
    """
    if request.user.is_anonymous():
        #tell user they need to be logged in to do that
        return HttpResponseRedirect(
            '/accounts/login/')  #redirect to login page
    else:
        currentUser = request.user
        userProfile = profileUtil.getProfileFromUser(currentUser)
        print(userProfile.personalShed)
        reputation = profileUtil.getReputation(userProfile)
        timeCreated = userProfile.timeCreated
        streetAddress = profileUtil.getAddress(userProfile)
        city = profileUtil.getCity(userProfile)
        state = profileUtil.getStateName(userProfile)
        shareZone = profileUtil.getSharezone(userProfile)
        context = {}
        context.update(csrf(request))
        context['userProfile'] = userProfile
        context['timeStamp'] = timeCreated
        context['streetAddress'] = streetAddress
        context['reputation'] = reputation
        context['city'] = city
        context['state'] = state
        context['sharezone'] = shareZone
        context.update(content.genBaseLoggedIn(request))
        if contextArg:
            context.update(contextArg)
        return render_to_response('my_account.html', context)
コード例 #3
0
ファイル: content.py プロジェクト: roycohen2013/TheSquad
def genBaseLoggedIn(request):
	results = dict()
	results.update(genSuper())
	results['username'] = request.user.username
	results['community'] = profileUtil.getSharezone(profileUtil.getProfileFromUser(request.user))
	results['first_name'] = request.user.first_name
	results['last_name'] = request.user.last_name
	#get pict location
	results['picture'] = None
	#get top sheds
	results['topSheds'] = None
	#get notifications
	results.update(getNotifications(request))
	return results
コード例 #4
0
ファイル: content.py プロジェクト: roycohen2013/TheSquad
def genBaseLoggedIn(request):
    results = dict()
    results.update(genSuper())
    results['username'] = request.user.username
    results['community'] = profileUtil.getSharezone(
        profileUtil.getProfileFromUser(request.user))
    results['first_name'] = request.user.first_name
    results['last_name'] = request.user.last_name
    #get pict location
    results['picture'] = None
    #get top sheds
    results['topSheds'] = None
    #get notifications
    results.update(getNotifications(request))
    return results
コード例 #5
0
ファイル: content.py プロジェクト: roycohen2013/TheSquad
def genJustRegistered(account, profile):
    results = genSuper()
    results['username'] = account.username
    results['first_name'] = account.first_name
    results['last_name'] = account.last_name
    results['picture'] = None
    results['topSheds'] = None
    sheds = shedUtil.getAllShedsJoinedBy(profile)
    sharezone = profileUtil.getSharezone(profile)
    sharezoneMembers = profileUtil.getAllProfilesInSharezone(sharezone)
    #not done
    results['tools'] = None
    results['sheds'] = sheds
    results['borrowed'] = None
    results['sharezone'] = sharezone
    results['sharezoneMembers'] = sharezoneMembers
    return addGoodRegisterNoti(results)
コード例 #6
0
ファイル: content.py プロジェクト: roycohen2013/TheSquad
def genJustRegistered(account, profile):
	results = genSuper()
	results['username'] = account.username
	results['first_name'] = account.first_name
	results['last_name'] = account.last_name
	results['picture'] = None
	results['topSheds'] = None
	sheds = shedUtil.getAllShedsJoinedBy(profile)
	sharezone = profileUtil.getSharezone(profile)
	sharezoneMembers = profileUtil.getAllProfilesInSharezone(sharezone)
	#not done
	results['tools'] = None
	results['sheds'] = sheds
	results['borrowed'] = None
	results['sharezone'] = sharezone
	results['sharezoneMembers'] = sharezoneMembers
	return addGoodRegisterNoti(results)
コード例 #7
0
ファイル: content.py プロジェクト: roycohen2013/TheSquad
def genUserHome(request):
    results = genBaseLoggedIn(request)
    profile = profileUtil.getProfileFromUser(request.user)
    tools = toolUtil.getAllToolsOwnedBy(profile)
    sheds = shedUtil.getAllShedsJoinedBy(profile)
    #sheds = None
    borrowedTools = toolUtil.getAllToolsBorrowedBy(profile)
    #borrowedTools = None
    #print(profile)
    #results['notif'] = notifUtil.getAllActiveProfileNotifs(profile)
    sharezone = profileUtil.getSharezone(profile)
    sharezoneMembers = profileUtil.getAllProfilesInSharezone(sharezone)
    #not done
    results['tools'] = tools
    results['sheds'] = sheds
    results['borrowed'] = borrowedTools
    results['sharezone'] = sharezone
    results['sharezoneMembers'] = sharezoneMembers
    return results
コード例 #8
0
ファイル: content.py プロジェクト: roycohen2013/TheSquad
def genUserHome(request):
	results = genBaseLoggedIn(request)
	profile = profileUtil.getProfileFromUser(request.user)
	tools = toolUtil.getAllToolsOwnedBy(profile)
	sheds = shedUtil.getAllShedsJoinedBy(profile)
	#sheds = None
	borrowedTools = toolUtil.getAllToolsBorrowedBy(profile)
	#borrowedTools = None
	#print(profile)
	#results['notif'] = notifUtil.getAllActiveProfileNotifs(profile)
	sharezone = profileUtil.getSharezone(profile)
	sharezoneMembers = profileUtil.getAllProfilesInSharezone(sharezone)
	#not done
	results['tools'] = tools
	results['sheds'] = sheds
	results['borrowed'] = borrowedTools
	results['sharezone'] = sharezone
	results['sharezoneMembers'] = sharezoneMembers
	return results
コード例 #9
0
 def test_UpdateShareZone(self):
     """
     """
     profUtils.updateSharezone(self.getProfile, "Sandpeople")
     self.assertEqual (profUtils.getSharezone(self.getProfile), "Sandpeople")
コード例 #10
0
 def test_GetShareZone(self):
     """
     """
     self.assertEqual (profUtils.getSharezone(self.getProfile), "Jedi Temple")
コード例 #11
0
ファイル: old_tests.py プロジェクト: roycohen2013/TheSquad
 def test_UpdateShareZone(self):
     """
     """
     profUtils.updateSharezone(self.getProfile, "Sandpeople")
     self.assertEqual(profUtils.getSharezone(self.getProfile), "Sandpeople")
コード例 #12
0
ファイル: old_tests.py プロジェクト: roycohen2013/TheSquad
 def test_GetShareZone(self):
     """
     """
     self.assertEqual(profUtils.getSharezone(self.getProfile),
                      "Jedi Temple")