16 lines
390 B
Python
16 lines
390 B
Python
# utils/notice.py
|
|
from article.models import Notice
|
|
|
|
|
|
def get_user_notices(user):
|
|
"""获取用户有权查看且需签收的通知"""
|
|
if user.dept:
|
|
notices = Notice.objects.filter(
|
|
target_departments=user.dept,
|
|
require_sign=True,
|
|
is_published=True
|
|
).distinct()
|
|
else:
|
|
notices = Notice.objects.none()
|
|
return notices
|