You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
381 B
13 lines
381 B
from django.contrib.auth.models import AnonymousUser
|
|
|
|
from taskapp.models import Task
|
|
from accounts_app.models import UserProfile
|
|
|
|
|
|
def get_active_tasks_count(request):
|
|
tasks_count = 0
|
|
if isinstance(request.user, UserProfile):
|
|
tasks_count = Task.objects.filter(recipients__in=[request.user], state='S').count()
|
|
return {
|
|
'tasks_count': tasks_count
|
|
}
|