added user_not_reviewed to templatetags
This commit is contained in:
parent
9ab34b8ea5
commit
db7f8fac5d
1 changed files with 7 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
from django import template
|
||||
|
||||
from symposion.reviews.models import Review, ReviewAssignment
|
||||
from symposion.proposals.models import ProposalBase
|
||||
|
||||
|
||||
register = template.Library()
|
||||
|
@ -12,6 +13,12 @@ def user_reviews(context):
|
|||
reviews = Review.objects.filter(user=request.user)
|
||||
return reviews
|
||||
|
||||
@register.assignment_tag(takes_context=True)
|
||||
def user_not_reviewed(context):
|
||||
request = context["request"]
|
||||
already_reviewed = [r.proposal_id for r in Review.objects.filter(user=request.user)]
|
||||
yet_to_review = ProposalBase.objects.exclude(id__in=[p.id for p in ProposalBase.objects.filter(id__in=already_reviewed)]).exclude(speaker=request.user)
|
||||
return yet_to_review
|
||||
|
||||
@register.assignment_tag(takes_context=True)
|
||||
def review_assignments(context):
|
||||
|
|
Loading…
Reference in a new issue