예제 #1
0
파일: views.py 프로젝트: shredz/Tool
def like_deal(request,deal_id):
	if request.user.is_authenticated():
		user = User.instance(request.user)
		try:
			deal = Deal.objects.get(id=deal_id)
		except Deal.DoesNotExist, dne:
			return Response({"success":False,"message":"Deal does not exist"})
		try:
			ud = UserDeal.objects.get(deal=deal,user=user)
			return Response.json({"success":False,"message":"Already in my deals","at":str(ud.added)})
		except UserDeal.DoesNotExist,ex:
			ud = UserDeal(deal=deal,user=user)
			ud.save()
			return Response.json({"success":True,"message":"success added to my deals", "id":ud.id})
예제 #2
0
파일: views.py 프로젝트: shredz/Tool
def facebook_feed(request):
	f_acc = feed_account(request,"facebook")
	if f_acc is dict:
		return Response.json(f_acc)
	
	fb = Facebook(settings.CRED['FACEBOOK_APP_ID'] ,settings.CRED['FACEBOOK_APP_SECRET'],settings.CRED['FACEBOOK_RETURN_URL'])
	params = {"feed" : fb.news_feed(f_acc.oauth_token)}
	return Response.render_html("social/facebook_feed.html",params)
예제 #3
0
파일: views.py 프로젝트: shredz/Tool
def twitter_feed(request):
	f_acc = feed_account(request,"twitter")
	if f_acc is dict:
		return Response.json(f_acc)
	
	twt = Twitter(settings.CRED['TWITTER_CONSUMER_KEY'] ,settings.CRED['TWITTER_CONSUMER_SECRET'],settings.CRED['TWITTER_RETURN_URL'])
	
	#return Response.json(twt.home_timeline(f_acc))
	
	params = {"feed":twt.home_timeline(f_acc)}
	return Response.render_html("social/twitter_feed.html",params)
예제 #4
0
파일: views.py 프로젝트: shredz/Tool
def reject_deal(request , deal_id):
	deal = Deal.objects.get(id=deal_id)
	deal.delete()
	
	return Response.json({"success" : True , "message" : "Deal Has Been DELETED"})
예제 #5
0
파일: views.py 프로젝트: shredz/Tool
def approve_deal(request, deal_id):
	deal = Deal.objects.get(id=deal_id)
	deal.approved = True
	deal.save()
	
	return Response.json({"success" : True , "message" : "Deal Has Been Approved"})