From dcc0f2102d804d804eed163395102b1fbe4a4b0e Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Wed, 10 Aug 2011 09:12:52 +0100 Subject: [PATCH] Fixes some small issues with HR --- app/hr/utils.py | 2 +- app/hr/views.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/hr/utils.py b/app/hr/utils.py index b514343..76a761b 100644 --- a/app/hr/utils.py +++ b/app/hr/utils.py @@ -27,7 +27,7 @@ def blacklist_values(user, level=BLACKLIST_LEVEL_NOTE): """ blacklist = [] - bl_items = Blacklist.objects.filter(level__lte=level, models.Q(expiry_date__gt=datetime.now()) | models.Q(expiry_date=None)) + bl_items = Blacklist.objects.filter(models.Q(expiry_date__gt=datetime.now()) | models.Q(expiry_date=None), level__lte=level) # Check Reddit blacklists if installed('reddit'): diff --git a/app/hr/views.py b/app/hr/views.py index 9cb87ed..90c7c2a 100644 --- a/app/hr/views.py +++ b/app/hr/views.py @@ -64,7 +64,9 @@ def check_permissions(user, application=None): @login_required def index(request): hrstaff = check_permissions(request.user) - can_recommend = len(blacklist_values(request.user, BLACKLIST_LEVEL_ADVISORY)) + can_recommend = False + if len(blacklist_values(request.user, BLACKLIST_LEVEL_ADVISORY)) == 0: + can_recommend = True return render_to_response('hr/index.html', locals(), context_instance=RequestContext(request)) ### Application Management