Switch reddit posts to be a AJAX request

This commit is contained in:
2010-10-13 12:03:19 +01:00
parent b6c9f96d60
commit df9ff2cce0

View File

@@ -88,14 +88,15 @@ def view_application(request, applicationid):
else: else:
return HttpResponseRedirect(reverse('hr.views.index')) return HttpResponseRedirect(reverse('hr.views.index'))
posts = [] if response.GET.has_key('redditxhr'):
for acc in app.user.redditaccount_set.all(): posts = []
try: for acc in app.user.redditaccount_set.all():
accposts = acc.recent_posts() try:
except: accposts = acc.recent_posts()
reddit_error = "Encountered a error while trying to get all Reddit posts" except:
accposts = [] accposts = []
posts.extend(accposts) posts.extend(accposts)
return HttpResponse(simplejson.dumps(accposts), mimetype='application/javascript')
return render_to_response('hr/applications/view.html', locals(), context_instance=RequestContext(request)) return render_to_response('hr/applications/view.html', locals(), context_instance=RequestContext(request))