def get_user_dept(request):
 user_id = request.user.id
 if user_id:
  user_dept = User.objects.get(id=user_id).dept
  return user_dept.id

def get_user_dept ( request ) : user_id = request . user . id if user_id : user_dept = User . objects . get ( id = user_id ) . dept return user_dept . id
get the user dept id 获取用户的部门id .