сколько непрочитанных сообщений

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
import usermessages.models as M
def get_count_unreaded_messages(request):
if not request.user.is_anonymous():
return M.Message.objects.filter(owner=request.user,readed=False).count()
return 0
def unreaded_count(request):
return {
'usermessages_unreaded_count':lambda: get_count_unreaded_messages(request)
}